I'd like to restore a file that has been deleted in some commit, and restore it under a different name, so that it shares the history. In subversion, I'd do
svn cp src@REV dest
i.e. use peg revisions. What's the equivalent in Mercurial?
I don't think Mercurial has a built-in way to do this. But I think you can get the same effect via:
hg up -C REV # Update to revision containing a copy of the file
<modify the file in question>
hg commit # Create second head based on old revision
hg merge # Merge two heads into one
# Note: make sure to choose to have the file exist
hg commit
hg mv MYFILE MYNEWNAME
This will have the file keep all its old history, as best Mercurial can track it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With