changeset 30629:e92776c00ffd

convert: use return value in parse_view() instead of manipulating state
author David Soria Parra <davidsp@fb.com>
date Tue, 20 Dec 2016 09:23:50 -0800
parents a001cd7296a5
children 3830f8806094
files hgext/convert/p4.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/p4.py	Mon Dec 19 04:25:18 2016 +0100
+++ b/hgext/convert/p4.py	Tue Dec 20 09:23:50 2016 -0800
@@ -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]