[PATCH 3 of 5 STABLE] bookmark: issue a single call to `allsuccessors` per loop
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Wed Oct 24 17:32:20 CDT 2012
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1351094121 -7200
# Branch stable
# Node ID 3b474ae49202d098bc4717eba9f90ca660cfd1af
# Parent 751708f1d8dfdd497532ca0111074a927bce708e
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,9 @@
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()]))
+ # obsolescence marker does not apply to immutable changeset
+ mutable = [c.node() for c in validdests if c.mutable()]
+ succs.update(obsolete.allsuccessors(repo.obsstore, mutable))
validdests = set(repo.set('%ln::', succs))
validdests.remove(old)
return new in validdests
More information about the Mercurial-devel
mailing list