Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple way to revert .orig files?

Tags:

mercurial

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

like image 496
David Wolever Avatar asked Dec 16 '10 19:12

David Wolever


2 Answers

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

for thefile in *.orig ; do cp -v $thefile ${thefile%%.orig} ; done
like image 130
Ry4an Brase Avatar answered Nov 15 '22 07:11

Ry4an Brase


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
like image 4
Brendan Maguire Avatar answered Nov 15 '22 07:11

Brendan Maguire