# HG changeset patch # User Martin Geisler # Date 2009-05-17 14:55:51 # Node ID 3e16c0fc22416afc30706635e0dccedb50a21eaf # Parent d728f126c1b75404ef7581b3f90ca15eabd09d78 repair: bulk update sets Use a single set.update and set.difference_update call instead of many set.add and set.discard calls. diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -26,10 +26,7 @@ def _collectfiles(repo, striprev): 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 @@ def strip(ui, repo, node, backup="all"): 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]