通过文件模式还原SVN文件 [英] Revert svn files by file pattern
本文介绍了通过文件模式还原SVN文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试找到一个命令(可以是bash命令)来还原一组svn文件.
I'm trying to find a command (can be bash command) to revert a group of svn files.
假设我的结帐方式有所更改,然后运行svn st
并获得以下输出:
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
现在,我想找到一个对SomeFolderA
下所有文件执行svn revert
的命令.
Now I want to find a command that does svn revert
on all the files under SomeFolderA
.
我尝试过这样的事情:
svn st | grep SomeFolderA | svn revert
但是收到以下错误消息:
But got this error message:
svn: Try 'svn help' for more info
svn: Not enough arguments provided
推荐答案
我最终做到的方法是创建以下命令:
The way I finally did it is by creating this command:
svn st | grep SomeFolderA | awk {'print $2'} | xargs svn revert
说明:
-
svn st
-查找所有修改后的文件 -
grep SomeFolderA
-过滤svn输出以仅显示具有SomeFolderA
的行
-
awk {'print $2'}
-删除每条输出行开头的M
-
xargs svn revert
-xargs
命令使用先前命令的输出,并将其原样传递给svn revert
命令
svn st
- Finds all the modified filegrep SomeFolderA
- Filters the svn output to only show lines that haveSomeFolderA
awk {'print $2'}
- removes theM
at the beginning of each output linexargs svn revert
- Thexargs
command uses the output from previous command and passes it, as is, to thesvn revert
command
这篇关于通过文件模式还原SVN文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文