changeset 10010:2fce96916d97

changegroupsubset: simplify parents pruning
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 04 Dec 2009 17:42:59 +0100
parents 69dca8574a6a
children a9836feb5a8c
files mercurial/localrepo.py
diffstat 1 files changed, 2 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Fri Dec 04 15:36:13 2009 +0100
+++ b/mercurial/localrepo.py	Fri Dec 04 17:42:59 2009 +0100
@@ -1707,18 +1707,8 @@
         # also assume the recipient will have all the parents.  This function
         # prunes them from the set of missing nodes.
         def prune_parents(revlog, hasset, msngset):
-            haslst = list(hasset)
-            haslst.sort(key=revlog.rev)
-            for node in haslst:
-                parentlst = [p for p in revlog.parents(node) if p != nullid]
-                while parentlst:
-                    n = parentlst.pop()
-                    if n not in hasset:
-                        hasset.add(n)
-                        p = [p for p in revlog.parents(n) if p != nullid]
-                        parentlst.extend(p)
-            for n in hasset:
-                msngset.pop(n, None)
+            for r in revlog.ancestors(*[revlog.rev(n) for n in hasset]):
+                msngset.pop(revlog.node(r), None)
 
         # This is a function generating function used to set up an environment
         # for the inner function to execute in.