convert: move localname state to function scope
authorDavid Soria Parra <davidsp@fb.com>
Tue, 20 Dec 2016 09:23:50 -0800
changeset 30630 3830f8806094
parent 30629 e92776c00ffd
child 30631 c2be48e56d59
convert: move localname state to function scope
hgext/convert/p4.py
--- a/hgext/convert/p4.py	Tue Dec 20 09:23:50 2016 -0800
+++ b/hgext/convert/p4.py	Tue Dec 20 09:23:50 2016 -0800
@@ -64,7 +64,6 @@
         self.encoding = self.ui.config('convert', 'p4.encoding',
                                        default=convcmd.orig_encoding)
         self.depotname = {}           # mapping from local name to depot name
-        self.localname = {} # mapping from depot name to local name
         self.re_type = re.compile(
             "([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)"
             "(\+\w+)?$")
@@ -168,6 +167,7 @@
             files = []
             copies = {}
             copiedfiles = []
+            localname = {}
             i = 0
             while ("depotFile%d" % i) in d and ("rev%d" % i) in d:
                 oldname = d["depotFile%d" % i]
@@ -181,7 +181,7 @@
                     self.depotname[filename] = oldname
                     if (d.get("action%d" % i) == "move/add"):
                         copiedfiles.append(filename)
-                    self.localname[oldname] = filename
+                    localname[oldname] = filename
                 i += 1
 
             # Collect information about copied files
@@ -208,8 +208,8 @@
                                 j += 1
                         i += 1
 
-                    if copiedoldname and copiedoldname in self.localname:
-                        copiedfilename = self.localname[copiedoldname]
+                    if copiedoldname and copiedoldname in localname:
+                        copiedfilename = localname[copiedoldname]
                         break
 
                 if copiedfilename: