diff hgext/convert/hg.py @ 28900:b65966f50058

convert: keep converted hg parents that are outside convert.hg.revs (BC) Before, when converting revisions without also including their already converted parents in convert.hg.revs, the parents would no longer be parents. That seems unfortunate and we dare to assume that nobody ever wants that. Instead, preserve parents that are outside the current convert range but already have been converted. The parents returned in getcommit() are unconditionally converted, so we introduce a separate optparents with optional parents.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 13 Apr 2016 00:16:21 +0200
parents 86db5cb55d46
children a0939666b836
line wrap: on
line diff
--- a/hgext/convert/hg.py	Thu Mar 24 16:01:07 2016 -0700
+++ b/hgext/convert/hg.py	Wed Apr 13 00:16:21 2016 +0200
@@ -582,7 +582,9 @@
 
     def getcommit(self, rev):
         ctx = self._changectx(rev)
-        parents = [p.hex() for p in self._parents(ctx)]
+        _parents = self._parents(ctx)
+        parents = [p.hex() for p in _parents]
+        optparents = [p.hex() for p in ctx.parents() if p and p not in _parents]
         crev = rev
 
         return common.commit(author=ctx.user(),
@@ -591,6 +593,7 @@
                              desc=ctx.description(),
                              rev=crev,
                              parents=parents,
+                             optparents=optparents,
                              branch=ctx.branch(),
                              extra=ctx.extra(),
                              sortkey=ctx.rev(),