Mercurial > evolve
comparison hgext/evolve.py @ 1383:cf62abb62941 stable
evolve: move 'precursors()' to smarted usage
The "new" smarted can be significantly more efficient than the old was. We
convert our revset to take advantage of that.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 18 Jun 2015 16:15:00 -0700 |
parents | c431f827f366 |
children | 64c8b8c27811 |
comparison
equal
deleted
inserted
replaced
1382:c431f827f366 | 1383:cf62abb62941 |
---|---|
419 for r in s: | 419 for r in s: |
420 for p in markerbysubj.get(node(r), ()): | 420 for p in markerbysubj.get(node(r), ()): |
421 pr = nm.get(p[0]) | 421 pr = nm.get(p[0]) |
422 if pr is not None: | 422 if pr is not None: |
423 cs.add(pr) | 423 cs.add(pr) |
424 cs -= repo.changelog.filteredrevs # nodemap has no filtering | |
424 return cs | 425 return cs |
425 | 426 |
426 def _allprecursors(repo, s): # XXX we need a better naming | 427 def _allprecursors(repo, s): # XXX we need a better naming |
427 """transitive precursors of a subset""" | 428 """transitive precursors of a subset""" |
428 node = repo.changelog.node | 429 node = repo.changelog.node |
513 def revsetprecursors(repo, subset, x): | 514 def revsetprecursors(repo, subset, x): |
514 """``precursors(set)`` | 515 """``precursors(set)`` |
515 Immediate precursors of changesets in set. | 516 Immediate precursors of changesets in set. |
516 """ | 517 """ |
517 s = revset.getset(repo, revset.fullreposet(repo), x) | 518 s = revset.getset(repo, revset.fullreposet(repo), x) |
518 cs = _precursors(repo, s) | 519 s = revset.baseset(_precursors(repo, s)) |
519 return [r for r in subset if r in cs] | 520 s.sort() |
521 return subset & s | |
520 | 522 |
521 | 523 |
522 @eh.revset('allprecursors') | 524 @eh.revset('allprecursors') |
523 def revsetallprecursors(repo, subset, x): | 525 def revsetallprecursors(repo, subset, x): |
524 """``allprecursors(set)`` | 526 """``allprecursors(set)`` |