Re-establish file history after rename post push?

Robin Pellatt robin.pellatt at gmail.com
Wed Feb 1 11:51:21 UTC 2012


On 27 January 2012 03:42, Kevin Bullock <kbullock+mercurial at ringworld.org>wrote:

> On 26 Jan 2012, at 4:26 PM, Haszlakiewicz, Eric wrote:
>
> -----Original Message-----
>
> From: mercurial-bounces at selenic.com [mailto:mercurial-
>
>
> I renamed/moved some file without using hg rename or visualhg, so the
>
> file history is not available referencing the new filename.  I know
>
> what I did wrong, but was wondering if there is a command that would
>
> re-establish this file history post push?
>
>
> Now there are new changes on the files that Mercurial thinks are new,
>
> so merging is more complicated!
>
>
> Maybe try:
> 1) update your working directory to before you did the rename
> 2) do an actual "hg rename" which will create a new head
> 3) merge that new head into the revision where you did the "manual" rename
> (not the head revision!)
> 4) Then finally merge the head revision into this merge result.
>
> However, I haven't ever tried anything like that, so be sure to check that
> this does something reasonable before pushing any changed out of a
> temporary working clone. :)
>
>
> I just did a quick test of this with a trivial repo (hg init foo && cd foo
> && echo a>>a && hg ci -Am0; etc.), and it does indeed seem to work. Merging
> another branch that modifies the original file does end up merging the
> changes into the renamed file.
>
> I think this merits an entry on the TipsAndTricks page on the wiki.
>
> pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
> Kevin R. Bullock
>
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
>
> This was very well timed, I just did exactly the same thing myself.  I can
confirm the method given above works perfectly.  I've also taken the
liberty of following up Kevin's suggestion, so it is now item 36 in
the TipsAndTricks
page <http://mercurial.selenic.com/wiki/TipsAndTricks>.
Cheers,
Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20120201/591834e4/attachment-0002.html>


More information about the Mercurial mailing list