如何在Mercurial中提取变更集的所有变更文件? [英] How can I extract all changed files of a changeset in Mercurial?

查看:162
本文介绍了如何在Mercurial中提取变更集的所有变更文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

直到最近,我们一直将SVN用于Web Studio的所有项目,并且Subversive和TortoiseSVN等多个客户端中提供了一个非常方便的功能,该功能可以提取特定版本中已更改的所有文件.

Until recently we have been using SVN for all projects of our web studio, and there is a very convenient feature present in several clients like Subversive and TortoiseSVN that can extract all files that have been changed in a certain revision.

在Mercurial中有没有办法做到这一点?我不在乎是否通过GUI或命令行完成,拥有一组在特定变更集中已更改的文件非常方便.

Is there a way to do it in Mercurial? I don't care if it's done via a GUI or a command line, it's just very convenient to have a set of files that have been changed in a certain changeset.

P.S.我一定是第一次把它弄错了.我不仅需要文件列表,还可以将所有文件导出到其他文件夹.

P.S. I must have put it wrong the first time. I need more than just a list of files, it would be great to have all the files exported to some other folder.

推荐答案

基于Jerome的答案,这将为您提供在修订版本4中更改的文件的副本:

Building on Jerome's answer this will get you the copies of the files that changed in revision 4:

hg archive --type files --rev 4 -I $(hg log -r 4 --template {files} | sed 's/ / -I /g') ~/changedfiles

这会将所有更改为第4版的文件放入您的homedir中一个新创建的目录,名为更改文件.

That puts all the files that changed into revision four into a newly created directory named changedfiles in your homedir.

如果将其更改为:

hg archive --type zip --rev 4 -I $(hg log -r 4 --template {files} | sed 's/ / -I /g') ~/changedfiles.zip

然后它们显示在zip归档文件中.

then they show up in a zip archive.

值得注意的是,仅当文件名中没有空格时,该选项才有效.如果您犯了这样的错误,那么我们将需要使用hg status --print0 -r revision -r parent-of-revision,但是希望这不是必需的.

It's worth noting that that only works if you have no spaces in filenames. If you made that blunder then we'll need to use hg status --print0 -r revision -r parent-of-revision instead, but hopefully that's not necessary.

还要注意,在我们的示例中,修订号"4"显示了两次.整个内容可以很容易地包装在shell脚本中,并且可以对其进行参数化,因此您不必记住在两个地方都进行更改.

Note also that the revision number, '4' in our example, shows up twice. The whole thing could very easily be wrapped in a shell script, and that would be parameterized so you don't have to remember to change it in both places.

这篇关于如何在Mercurial中提取变更集的所有变更文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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