diff hgext/convert/convcmd.py @ 9431:d1b135f2f415

convert: fix history topology when using hg.tagsbranch When using hg.tagsbranch, all conversions fail at transcribing the source repo topology with conversion scenarios interleaving: - initial repo conversion, - then upstream tag - then later incremental conversion The problem is caused by the usage of the last source revid as source revid for the tagnode in the revision map. On a later incremental conversion, when resolving some child commit of the true last source revid, convert will parent the nodes to the tag node. If using tagsbranch you get a bad topology where all incremental commit nodes end up in the tag branch. Analysis and test by Edouard Gomez <ed.gomez@free.fr>
author Patrick Mezard <pmezard@gmail.com>
date Sun, 06 Sep 2009 15:29:14 +0200
parents eb7b247a98ea
children a7178eccf2dc 25e572394f5c
line wrap: on
line diff
--- a/hgext/convert/convcmd.py	Sat Sep 05 18:56:51 2009 +0200
+++ b/hgext/convert/convcmd.py	Sun Sep 06 15:29:14 2009 +0200
@@ -336,11 +336,14 @@
                     ctags[k] = self.map[v]
 
             if c and ctags:
-                nrev = self.dest.puttags(ctags)
-                # write another hash correspondence to override the previous
-                # one so we don't end up with extra tag heads
-                if nrev:
-                    self.map[c] = nrev
+                nrev, tagsparent = self.dest.puttags(ctags)
+                if nrev and tagsparent:
+                    # write another hash correspondence to override the previous
+                    # one so we don't end up with extra tag heads
+                    tagsparents = [e for e in self.map.iteritems()
+                                   if e[1] == tagsparent]
+                    if tagsparents:
+                        self.map[tagsparents[0][0]] = nrev
 
             self.writeauthormap()
         finally: