Mercurial > hg
comparison mercurial/bookmarks.py @ 17917:12178f07de97
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`.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Wed, 24 Oct 2012 17:55:21 +0200 |
parents | ed225834b372 |
children | 2eb5f4d1c235 |
comparison
equal
deleted
inserted
replaced
17916:ed225834b372 | 17917:12178f07de97 |
---|---|
261 plen = -1 | 261 plen = -1 |
262 # compute the whole set of successors or descendants | 262 # compute the whole set of successors or descendants |
263 while len(validdests) != plen: | 263 while len(validdests) != plen: |
264 plen = len(validdests) | 264 plen = len(validdests) |
265 succs = set(c.node() for c in validdests) | 265 succs = set(c.node() for c in validdests) |
266 for c in validdests: | 266 mutable = [c.node() for c in validdests if c.mutable()] |
267 if c.mutable(): | 267 succs.update(obsolete.allsuccessors(repo.obsstore, mutable)) |
268 # obsolescence marker does not apply to public changeset | |
269 succs.update(obsolete.allsuccessors(repo.obsstore, | |
270 [c.node()])) | |
271 known = (n for n in succs if n in nm) | 268 known = (n for n in succs if n in nm) |
272 validdests = set(repo.set('%ln::', known)) | 269 validdests = set(repo.set('%ln::', known)) |
273 validdests.remove(old) | 270 validdests.remove(old) |
274 return new in validdests | 271 return new in validdests |
275 else: | 272 else: |