Mercurial > hg
comparison mercurial/obsutil.py @ 43541:1944aaaecabf
index: use `index.has_node` in `obsutil.foreground`
Differential Revision: https://phab.mercurial-scm.org/D7334
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 08 Nov 2019 14:20:48 +0100 |
parents | c8f1e8412db4 |
children | acaff50079ff |
comparison
equal
deleted
inserted
replaced
43540:c8f1e8412db4 | 43541:1944aaaecabf |
---|---|
326 repo = repo.unfiltered() | 326 repo = repo.unfiltered() |
327 foreground = set(repo.set(b'%ln::', nodes)) | 327 foreground = set(repo.set(b'%ln::', nodes)) |
328 if repo.obsstore: | 328 if repo.obsstore: |
329 # We only need this complicated logic if there is obsolescence | 329 # We only need this complicated logic if there is obsolescence |
330 # XXX will probably deserve an optimised revset. | 330 # XXX will probably deserve an optimised revset. |
331 nm = repo.changelog.nodemap | 331 has_node = repo.changelog.index.has_node |
332 plen = -1 | 332 plen = -1 |
333 # compute the whole set of successors or descendants | 333 # compute the whole set of successors or descendants |
334 while len(foreground) != plen: | 334 while len(foreground) != plen: |
335 plen = len(foreground) | 335 plen = len(foreground) |
336 succs = set(c.node() for c in foreground) | 336 succs = set(c.node() for c in foreground) |
337 mutable = [c.node() for c in foreground if c.mutable()] | 337 mutable = [c.node() for c in foreground if c.mutable()] |
338 succs.update(allsuccessors(repo.obsstore, mutable)) | 338 succs.update(allsuccessors(repo.obsstore, mutable)) |
339 known = (n for n in succs if n in nm) | 339 known = (n for n in succs if has_node(n)) |
340 foreground = set(repo.set(b'%ln::', known)) | 340 foreground = set(repo.set(b'%ln::', known)) |
341 return set(c.node() for c in foreground) | 341 return set(c.node() for c in foreground) |
342 | 342 |
343 | 343 |
344 # effectflag field | 344 # effectflag field |