changegroupsubset: simplify prune
authorMatt Mackall <mpm@selenic.com>
Sun, 20 Mar 2011 19:43:28 -0500
changeset 13708 ce9b3043b79d
parent 13707 296e78744d32
child 13709 53826e7a1d22
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.
mercurial/localrepo.py
--- 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.