bookmark: issue a single call to `allsuccessors` per loop
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 24 Oct 2012 17:55:21 +0200
changeset 17917 12178f07de97
parent 17916 ed225834b372
child 17918 2eb5f4d1c235
bookmark: issue a single call to `allsuccessors` per loop Update to this code was minimalist when `allsuccessors` argument were changed from a list to a set. As this code is getting my attention again I realised we can drastically simplify this part of the code by issue a single call to `allsuccessors`.
mercurial/bookmarks.py
--- a/mercurial/bookmarks.py	Wed Oct 24 17:26:40 2012 +0200
+++ b/mercurial/bookmarks.py	Wed Oct 24 17:55:21 2012 +0200
@@ -263,11 +263,8 @@
         while len(validdests) != plen:
             plen = len(validdests)
             succs = set(c.node() for c in validdests)
-            for c in validdests:
-                if c.mutable():
-                    # obsolescence marker does not apply to public changeset
-                    succs.update(obsolete.allsuccessors(repo.obsstore,
-                                                        [c.node()]))
+            mutable = [c.node() for c in validdests if c.mutable()]
+            succs.update(obsolete.allsuccessors(repo.obsstore, mutable))
             known = (n for n in succs if n in nm)
             validdests = set(repo.set('%ln::', known))
         validdests.remove(old)