[PATCH 1 of 7 V3] obsolete: have `anysuccessors` takes a list of nodes

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Oct 16 20:48:05 UTC 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1350395398 -7200
# Node ID cf9539941c46582f731f82c8642539e9584bcf40
# Parent  72c234081ae1350220132c69750f5a093902a1e7
obsolete: have `anysuccessors` 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.

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -280,7 +280,7 @@
                 if c.phase() > phases.public:
                     # obsolescence marker does not apply to public changeset
                     succs.update(obsolete.anysuccessors(repo.obsstore,
-                                                        c.node()))
+                                                        [c.node()]))
             validdests = set(repo.set('%ln::', succs))
         validdests.remove(old)
         return new in validdests
diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -298,7 +298,7 @@
                 if nh in repo and repo[nh].phase() <= phases.public:
                     newhs.add(nh)
                 else:
-                    for suc in obsolete.anysuccessors(repo.obsstore, nh):
+                    for suc in obsolete.anysuccessors(repo.obsstore, [nh]):
                         if suc != nh and suc in allfuturecommon:
                             discardedheads.add(nh)
                             break
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -351,11 +351,11 @@
     for data in ctx._repo.obsstore.successors.get(ctx.node(), ()):
         yield marker(ctx._repo, data)
 
-def anysuccessors(obsstore, node):
-    """Yield every successor of <node>
+def anysuccessors(obsstore, nodes):
+    """Yield every successor of <nodes>
 
     This is a linear yield unsuited to detecting split changesets."""
-    remaining = set([node])
+    remaining = set(nodes)
     seen = set(remaining)
     while remaining:
         current = remaining.pop()



More information about the Mercurial-devel mailing list