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'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.
Wouldn't just (if you "hg remove
"d src in REV+1):
hg revert -rREV src
hg status
A src
hg rename src dest
hg commit -m"restored src and renamed it to dest"
work?
edited: I just tested it and it seems to be ok. Actually no "hg add
" is necessary for src as revert is taking care of this. However if you do just one commit instead of two (like in the code above), hg will give a warning:
src has not been committed yet, so no copy data will be stored for dest.
Hope it'll help.
Cheers,
Christophe.
= "Good judgment comes from experience. Experience comes from bad judgment." --Bob Packwood =