Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 33075:d83b189aef83
dagop: change revdescendants() to include all root revisions
Prepares for adding depth support. I want to process depth=0 in
revdescendants() to make things simpler.
only() also calls dagop.revdescendants(), but it filters out root revisions
explicitly. So this should cause no problem.
# descendants(0) using hg repo
0) 0.052380
1) 0.051226
# only(tip) using hg repo
0) 0.001433
1) 0.001425
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 20 Jun 2017 22:26:52 +0900 |
parents | f63d111258da |
children | a53bfc2845f2 |
comparison
equal
deleted
inserted
replaced
33074:e999b59d6eb1 | 33075:d83b189aef83 |
---|---|
598 def _descendants(repo, subset, x, followfirst=False): | 598 def _descendants(repo, subset, x, followfirst=False): |
599 roots = getset(repo, fullreposet(repo), x) | 599 roots = getset(repo, fullreposet(repo), x) |
600 if not roots: | 600 if not roots: |
601 return baseset() | 601 return baseset() |
602 s = dagop.revdescendants(repo, roots, followfirst) | 602 s = dagop.revdescendants(repo, roots, followfirst) |
603 | 603 return subset & s |
604 # Both sets need to be ascending in order to lazily return the union | |
605 # in the correct order. | |
606 base = subset & roots | |
607 desc = subset & s | |
608 result = base + desc | |
609 if subset.isascending(): | |
610 result.sort() | |
611 elif subset.isdescending(): | |
612 result.sort(reverse=True) | |
613 else: | |
614 result = subset & result | |
615 return result | |
616 | 604 |
617 @predicate('descendants(set)', safe=True) | 605 @predicate('descendants(set)', safe=True) |
618 def descendants(repo, subset, x): | 606 def descendants(repo, subset, x): |
619 """Changesets which are descendants of changesets in set, including the | 607 """Changesets which are descendants of changesets in set, including the |
620 given changesets themselves. | 608 given changesets themselves. |