Patchwork [3,of,6,v3] convert: Allow passing in a revmap

login
register
mail settings
Submitter David Soria Parra
Date Dec. 7, 2016, 9:51 p.m.
Message ID <897be730ab884aa8f737.1481147513@devbig415.prn1.facebook.com>
Download mbox | patch
Permalink /patch/17868/
State Superseded
Headers show

Comments

David Soria Parra - Dec. 7, 2016, 9:51 p.m.
# HG changeset patch
# User David Soria Parra <davidsp@fb.com>
# Date 1480896014 28800
#      Sun Dec 04 16:00:14 2016 -0800
# Node ID 897be730ab884aa8f7373a34eeb6a288cc1dabc7
# Parent  c0168cd90fd67ccd20271416e0994abe6f95a201
convert: Allow passing in a revmap

Implement `setrevmap` which can be used to pass a map of existing revisions.
Ignore those revisions when going through Perforce changes. This will allow
incremental imports.

Patch

diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py
--- a/hgext/convert/p4.py
+++ b/hgext/convert/p4.py
@@ -55,6 +55,7 @@ 
 
         common.checktool('p4', abort=False)
 
+        self.revmap = {}
         self.p4changes = {}
         self.heads = {}
         self.changeset = {}
@@ -80,6 +81,9 @@ 
                                "multiple revisions"))
         self._parse(ui, path)
 
+    def setrevmap(self, revmap):
+        self.revmap = revmap
+
     def _parse_view(self, path):
         "Read changes affecting the path"
         cmd = 'p4 -G changes -s submitted %s' % util.shellquote(path)
@@ -135,6 +139,9 @@ 
                 continue
             if self.revs and int(change) > int(self.revs[0]):
                 continue
+            if change in self.revmap:
+                lastid = change
+                continue
 
             cmd = "p4 -G describe -s %s" % change
             stdout = util.popen(cmd, mode='rb')