Recover history on "hg remove" & "hg add" instead of "hg move"

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri May 7 05:44:52 UTC 2021



On 5/5/21 7:58 AM, Steve Barnes wrote:
> Hi Manish,
> 
> If you have made no other commits since then you can:
> 
>    hg backout -r R
> 
> where R is the revision that did this. Then use:
> 
>    hg move
> 
> to move the directory.

In don't think this will work as the backout will create new files, 
disconnect from the previous files history.

I would recommand doing the follow seems more promising:


Let's says you have the following history:

    A → B → C → D → E

Where C is the bad commit, that did the `hg rm` + `hg add`


$ hg update 'parents(C)'
$ hg mv old new
$ hg commit -m "move old to new, bla bla bla bla"
$ hg merge 'C'

They is a good chance that you get the right copy tracing after that. If 
you don't we are about to roll a newer version of the copy tracing that 
should work.

-- 
Pierre-Yves David



More information about the Mercurial mailing list