obsolete: have `allsuccessors` takes a list of nodes
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 16 Oct 2012 15:49:58 +0200
changeset 17827 612db9d7e76a
parent 17826 46e1a4e24225
child 17828 9495be4126ef
obsolete: have `allsuccessors` takes a list of nodes Additional logic, used to detect mutable history troubles, will need to quickly compute successors of a whole set of changeset.
mercurial/bookmarks.py
mercurial/discovery.py
mercurial/obsolete.py
--- a/mercurial/bookmarks.py	Fri Oct 19 00:30:11 2012 +0200
+++ b/mercurial/bookmarks.py	Tue Oct 16 15:49:58 2012 +0200
@@ -267,7 +267,7 @@
                 if c.phase() > phases.public:
                     # obsolescence marker does not apply to public changeset
                     succs.update(obsolete.allsuccessors(repo.obsstore,
-                                                        c.node()))
+                                                        [c.node()]))
             validdests = set(repo.set('%ln::', succs))
         validdests.remove(old)
         return new in validdests
--- a/mercurial/discovery.py	Fri Oct 19 00:30:11 2012 +0200
+++ b/mercurial/discovery.py	Tue Oct 16 15:49:58 2012 +0200
@@ -298,7 +298,7 @@
                 if nh in repo and repo[nh].phase() <= phases.public:
                     newhs.add(nh)
                 else:
-                    for suc in obsolete.allsuccessors(repo.obsstore, nh):
+                    for suc in obsolete.allsuccessors(repo.obsstore, [nh]):
                         if suc != nh and suc in allfuturecommon:
                             discardedheads.add(nh)
                             break
--- a/mercurial/obsolete.py	Fri Oct 19 00:30:11 2012 +0200
+++ b/mercurial/obsolete.py	Tue Oct 16 15:49:58 2012 +0200
@@ -351,11 +351,13 @@
     for data in ctx._repo.obsstore.successors.get(ctx.node(), ()):
         yield marker(ctx._repo, data)
 
-def allsuccessors(obsstore, node):
-    """Yield every successor of <node>
+def allsuccessors(obsstore, nodes):
+    """Yield node for every successor of <nodes>.
+
+    Some successors may be unknown locally.
 
     This is a linear yield unsuited to detecting split changesets."""
-    remaining = set([node])
+    remaining = set(nodes)
     seen = set(remaining)
     while remaining:
         current = remaining.pop()