convert: return commit objects for revisions in the revmap
authorDavid Soria Parra <davidsp@fb.com>
Wed, 14 Dec 2016 12:07:23 -0800
changeset 30604 b654112a0119
parent 30603 db9e883566e8
child 30605 c039eb03e652
convert: return commit objects for revisions in the revmap Source revision data that exists in the revmap are ignored when pulling data from Perforce as we consider them already imported. In case where the `convertcmd.convert` algorithm requests a commit object for such a revision we are creating it. This is usually the case for parent of the first imported revision.
hgext/convert/p4.py
--- a/hgext/convert/p4.py	Tue Dec 13 21:49:58 2016 -0800
+++ b/hgext/convert/p4.py	Wed Dec 14 12:07:23 2016 -0800
@@ -321,7 +321,13 @@
         return marshal.load(stdout)
 
     def getcommit(self, rev):
-        return self.changeset[rev]
+        if rev in self.changeset:
+            return self.changeset[rev]
+        elif rev in self.revmap:
+            d = self._fetch_revision(rev)
+            return self._construct_commit(d, parents=None)
+        raise error.Abort(
+            _("cannot find %s in the revmap or parsed changesets") % rev)
 
     def gettags(self):
         return {}