changeset 30604:b654112a0119

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.
author David Soria Parra <davidsp@fb.com>
date Wed, 14 Dec 2016 12:07:23 -0800
parents db9e883566e8
children c039eb03e652
files hgext/convert/p4.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 {}