changegroupsubset: simplify prune
Ancestors of nodes linked to commonrevs can be expected to be linked
to commonrevs. Walking graphs of each revlog looking for rare/nonexistent outliers is overkill.
--- a/mercurial/localrepo.py Sun Mar 20 19:43:28 2011 -0500
+++ b/mercurial/localrepo.py Sun Mar 20 19:43:28 2011 -0500
@@ -1508,18 +1508,13 @@
# also assume the recipient will have all the parents. This function
# prunes them from the set of missing nodes.
def prune(revlog, missingnodes):
- hasset = set()
- # If a 'missing' filenode thinks it belongs to a changenode we
- # assume the recipient must have, then the recipient must have
- # that filenode.
+ # drop any nodes that claim to be part of a cset in commonrevs
+ drop = set()
for n in missingnodes:
- clrev = revlog.linkrev(revlog.rev(n))
- if clrev in commonrevs:
- hasset.add(n)
- for n in hasset:
+ if revlog.linkrev(revlog.rev(n)) in commonrevs:
+ drop.add(n)
+ for n in drop:
missingnodes.pop(n, None)
- for r in revlog.ancestors(*[revlog.rev(n) for n in hasset]):
- missingnodes.pop(revlog.node(r), None)
# Now that we have all theses utility functions to help out and
# logically divide up the task, generate the group.