patch: use set instead of dict
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 17 May 2009 03:28:49 +0200
changeset 8461 88f317e7d280
parent 8460 d4c545dc6f87
child 8462 e7e4e41b3bbc
patch: use set instead of dict
mercurial/patch.py
--- a/mercurial/patch.py	Sun May 17 03:26:08 2009 +0200
+++ b/mercurial/patch.py	Sun May 17 03:28:49 2009 +0200
@@ -1033,7 +1033,7 @@
     if not patches:
         return
     copies = []
-    removes = {}
+    removes = set()
     cfiles = patches.keys()
     cwd = repo.getcwd()
     if cwd:
@@ -1044,14 +1044,13 @@
             continue
         if gp.op == 'RENAME':
             copies.append((gp.oldpath, gp.path))
-            removes[gp.oldpath] = 1
+            removes.add(gp.oldpath)
         elif gp.op == 'COPY':
             copies.append((gp.oldpath, gp.path))
         elif gp.op == 'DELETE':
-            removes[gp.path] = 1
+            removes.add(gp.path)
     for src, dst in copies:
         repo.copy(src, dst)
-    removes = removes.keys()
     if (not similarity) and removes:
         repo.remove(sorted(removes), True)
     for f in patches:
@@ -1240,7 +1239,7 @@
         for k, v in copy.items():
             copy[v] = k
 
-    gone = {}
+    gone = set()
     gitmode = {'l': '120000', 'x': '100755', '': '100644'}
 
     for f in sorted(modified + added + removed):
@@ -1262,7 +1261,7 @@
                     _addmodehdr(header, omode, mode)
                     if a in removed and a not in gone:
                         op = 'rename'
-                        gone[a] = 1
+                        gone.add(a)
                     else:
                         op = 'copy'
                     header.append('%s from %s\n' % (op, a))