Reputation: 21858
I'm trying to find a command (can be bash command) to revert a group of svn files.
Let's say I have some changes in my check-out and I run svn st
and get this output:
My-MacBook-2:trunk aetzioni$ svn st
M SomeFolderA/src/main/java/com/mycompany/package/classA.java
M SomeFolderA/main/java/com/mycompany/package/classB.java
M SomeFolderB/src/main/java/com/mycompany/package/classC.java
Now I want to find a command that does svn revert
on all the files under SomeFolderA
.
I tried something like this:
svn st | grep SomeFolderA | svn revert
But got this error message:
svn: Try 'svn help' for more info
svn: Not enough arguments provided
Upvotes: 0
Views: 1900
Reputation: 21858
The way I finally did it is by creating this command:
svn st | grep SomeFolderA | awk {'print $2'} | xargs svn revert
Explanation:
svn st
- Finds all the modified filegrep SomeFolderA
- Filters the svn output to only show lines that have SomeFolderA
awk {'print $2'}
- removes the M
at the beginning of each output linexargs svn revert
- The xargs
command uses the output from previous command and passes it, as is, to the svn revert
commandUpvotes: 5