通过文件模式还原SVN文件 [英] Revert svn files by file pattern

查看:79
本文介绍了通过文件模式还原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

说明:

  1. svn st-查找所有修改后的文件
  2. grep SomeFolderA-过滤svn输出以仅显示具有SomeFolderA
  3. 的行
  4. awk {'print $2'}-删除每条输出行开头的M
  5. xargs svn revert-xargs命令使用先前命令的输出,并将其原样传递给svn revert命令
  1. svn st - Finds all the modified file
  2. grep SomeFolderA - Filters the svn output to only show lines that have SomeFolderA
  3. awk {'print $2'} - removes the M at the beginning of each output line
  4. xargs svn revert - The xargs command uses the output from previous command and passes it, as is, to the svn revert command

这篇关于通过文件模式还原SVN文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆