Simple way to revert .orig files?

本秂侑毒 提交于 2019-12-18 19:34:13

问题


I've just gone and accidentally run hg revert *. Does Mercurial come with a tool to move all the .orig files back into place?


回答1:


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

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



回答2:


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



回答3:


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.



来源:https://stackoverflow.com/questions/4464585/simple-way-to-revert-orig-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!