[PATCH] context: replace pseudo-set by real set

Simon Heimberg simohe at besonet.ch
Thu May 14 04:00:48 CDT 2009


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1242291595 -7200
# Node ID 2056897b47b0f52013ace0d9bd369ca1d1af4749
# Parent  b2c0d61492eb713a5cf2a87d8fec21516b1eb035
context: replace pseudo-set by real set

diff -r b2c0d61492eb -r 2056897b47b0 mercurial/context.py
--- a/mercurial/context.py	Don Mai 14 10:52:17 2009 +0200
+++ b/mercurial/context.py	Don Mai 14 10:59:55 2009 +0200
@@ -155,19 +155,19 @@
         return changectx(self._repo, n)
 
     def walk(self, match):
-        fdict = dict.fromkeys(match.files())
+        fset = set(match.files())
         # for dirstate.walk, files=['.'] means "walk the whole tree".
         # follow that here, too
-        fdict.pop('.', None)
+        fset.discard('.')
         for fn in self:
-            for ffn in fdict:
+            for ffn in fset:
                 # match if the file is the exact name or a directory
                 if ffn == fn or fn.startswith("%s/" % ffn):
-                    del fdict[ffn]
+                    fset.remove(ffn)
                     break
             if match(fn):
                 yield fn
-        for fn in sorted(fdict):
+        for fn in sorted(fset):
             if match.bad(fn, 'No such file in rev ' + str(self)) and match(fn):
                 yield fn
 


More information about the Mercurial-devel mailing list