changeset 8468:b35d11d10646

copies: use set instead of dict
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 17 May 2009 04:20:59 +0200
parents 9890151a7f30
children cb897f10e54a
files mercurial/copies.py
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Sun May 17 04:16:44 2009 +0200
+++ b/mercurial/copies.py	Sun May 17 04:20:59 2009 +0200
@@ -20,18 +20,18 @@
     return f[:s]
 
 def _dirs(files):
-    d = {}
+    d = set()
     for f in files:
         f = _dirname(f)
         while f not in d:
-            d[f] = True
+            d.add(f)
             f = _dirname(f)
     return d
 
 def _findoldnames(fctx, limit):
     "find files that path was copied from, back to linkrev limit"
     old = {}
-    seen = {}
+    seen = set()
     orig = fctx.path()
     visit = [(fctx, 0)]
     while visit:
@@ -39,7 +39,7 @@
         s = str(fc)
         if s in seen:
             continue
-        seen[s] = 1
+        seen.add(s)
         if fc.path() != orig and fc.path() not in old:
             old[fc.path()] = (depth, fc.path()) # remember depth
         if fc.rev() < limit and fc.rev() is not None:
@@ -184,7 +184,7 @@
 
     # generate a directory move map
     d1, d2 = _dirs(m1), _dirs(m2)
-    invalid = {}
+    invalid = set()
     dirmove = {}
 
     # examine each file copy for a potential directory move, which is
@@ -196,13 +196,13 @@
             continue
         elif dsrc in d1 and ddst in d1:
             # directory wasn't entirely moved locally
-            invalid[dsrc] = True
+            invalid.add(dsrc)
         elif dsrc in d2 and ddst in d2:
             # directory wasn't entirely moved remotely
-            invalid[dsrc] = True
+            invalid.add(dsrc)
         elif dsrc in dirmove and dirmove[dsrc] != ddst:
             # files from the same directory moved to two different places
-            invalid[dsrc] = True
+            invalid.add(dsrc)
         else:
             # looks good so far
             dirmove[dsrc + "/"] = ddst + "/"