# HG changeset patch # User Pierre-Yves David # Date 2012-10-24 15:55:21 # Node ID 12178f07de97013dffa454765fdeef8947af0a7e # Parent ed225834b3720f249c74757963a96b1be98ccce0 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`. diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -263,11 +263,8 @@ def validdest(repo, old, new): 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)