repair: bulk update sets
authorMartin Geisler <mg@lazybytes.net>
Sun, 17 May 2009 16:55:51 +0200
changeset 8479 3e16c0fc2241
parent 8478 d728f126c1b7
child 8480 0e91bcaaa92c
repair: bulk update sets Use a single set.update and set.difference_update call instead of many set.add and set.discard calls.
mercurial/repair.py
--- a/mercurial/repair.py	Sun May 17 16:20:27 2009 +0200
+++ b/mercurial/repair.py	Sun May 17 16:55:51 2009 +0200
@@ -26,10 +26,7 @@
     files = set()
 
     for x in xrange(striprev, len(repo)):
-        for name in repo[x].files():
-            if name in files:
-                continue
-            files.add(name)
+        files.update(repo[x].files())
 
     return sorted(files)
 
@@ -100,8 +97,7 @@
             if parents[0] < striprev and parents[1] < striprev:
                 savebases.append(cl.node(r))
 
-            for p in parents:
-                saveheads.discard(p)
+            saveheads.difference_update(parents)
             saveheads.add(r)
 
     saveheads = [cl.node(r) for r in saveheads]