开发者

Simple way to revert .orig files?

开发者 https://www.devze.com 2023-01-31 12:42 出处:网络
I\'ve just gone and acci开发者_StackOverflow社区dentally run hg revert *. Does Mercurial come with a tool to move all the .orig files back into place?No.If you\'re in bash you can always do:

I've just gone and acci开发者_StackOverflow社区dentally run hg revert *. Does Mercurial come with a tool to move all the .orig files back into place?


No. If you're in bash you can always do:

for thefile in *.orig ; do cp -v $thefile ${thefile%%.orig} ; done


This command will reinstate your .orig files from anywhere inside your repo:

find `hg root` -name *.orig -exec rename -f 's/.orig//' {} \;

You can add a hg alias for this in your .hgrc like so:

[alias]
reinstate= !find `$HG root` -name *.orig -exec rename -f 's/.orig//' {} \;

And then run it from your repo using this command:

hg reinstate


No, but your operating system probably provides cp command (or equivalent). Just copy .orig onto reverted file, or, if you've commited the file in the wanted version, revert it again from that version.

0

精彩评论

暂无评论...
验证码 换一张
取 消