Simple way to revert .orig files?
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.
精彩评论