How can I extract all changed files of a changeset in Mercurial?

前端 未结 4 411
执笔经年
执笔经年 2021-02-02 03:40

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

4条回答
  •  遥遥无期
    2021-02-02 03:41

    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
    

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

    If you change it to:

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

    then they show up in a zip archive.

    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.

    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.

提交回复
热议问题