[PATCH 1 of 4] convert: use return value in parse_view() instead of manipulating state

David Soria Parra davidsp at fb.com
Tue Dec 20 13:07:19 EST 2016


# HG changeset patch
# User David Soria Parra <davidsp at fb.com>
# Date 1482254630 28800
#      Tue Dec 20 09:23:50 2016 -0800
# Node ID 4cb85a7af6deb30abfd4c40ec8e502560150999e
# Parent  392751cbb6c47a43676e324d2f1a4e45f35e624b
convert: use return value in parse_view() instead of manipulating state

diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py
--- a/hgext/convert/p4.py
+++ b/hgext/convert/p4.py
@@ -95,10 +95,12 @@
         "Read changes affecting the path"
         cmd = 'p4 -G changes -s submitted %s' % util.shellquote(path)
         stdout = util.popen(cmd, mode='rb')
+        p4changes = {}
         for d in loaditer(stdout):
             c = d.get("change", None)
             if c:
-                self.p4changes[c] = True
+                p4changes[c] = True
+        return p4changes
 
     def _parse(self, ui, path):
         "Prepare list of P4 filenames and revisions to import"
@@ -106,7 +108,7 @@
 
         # read client spec or view
         if "/" in path:
-            self._parse_view(path)
+            self.p4changes.update(self._parse_view(path))
             if path.startswith("//") and path.endswith("/..."):
                 views = {path[:-3]:""}
             else:
@@ -119,7 +121,7 @@
             for client in clientspec:
                 if client.startswith("View"):
                     sview, cview = clientspec[client].split()
-                    self._parse_view(sview)
+                    self.p4changes.update(self._parse_view(sview))
                     if sview.endswith("...") and cview.endswith("..."):
                         sview = sview[:-3]
                         cview = cview[:-3]


More information about the Mercurial-devel mailing list