comparison mercurial/revset.py @ 39837:85a474adaf26

merge with stable
author Yuya Nishihara <yuya@tcha.org>
date Wed, 26 Sep 2018 20:33:09 +0900
parents 1eb370761fa0 823f34acfd46
children d894d2372ffe
comparison
equal deleted inserted replaced
39836:7a9e2d85f475 39837:85a474adaf26
614 @predicate('_commonancestorheads(set)', safe=True) 614 @predicate('_commonancestorheads(set)', safe=True)
615 def _commonancestorheads(repo, subset, x): 615 def _commonancestorheads(repo, subset, x):
616 # This is an internal method is for quickly calculating "heads(::x and 616 # This is an internal method is for quickly calculating "heads(::x and
617 # ::y)" 617 # ::y)"
618 618
619 # These greatest common ancestors are the same ones that the consesus bid 619 # These greatest common ancestors are the same ones that the consensus bid
620 # merge will find. 620 # merge will find.
621 h = heads(repo, fullreposet(repo), x, anyorder) 621 startrevs = getset(repo, fullreposet(repo), x, order=anyorder)
622 622
623 ancs = repo.changelog._commonancestorsheads(*list(h)) 623 ancs = repo.changelog._commonancestorsheads(*list(startrevs))
624 return subset & baseset(ancs) 624 return subset & baseset(ancs)
625 625
626 @predicate('commonancestors(set)', safe=True) 626 @predicate('commonancestors(set)', safe=True)
627 def commonancestors(repo, subset, x): 627 def commonancestors(repo, subset, x):
628 """Returns all common ancestors of the set. 628 """Changesets that are ancestors of every changeset in set.
629 629 """
630 This method is for calculating "::x and ::y" (i.e. all the ancestors that 630 startrevs = getset(repo, fullreposet(repo), x, order=anyorder)
631 are common to both x and y) in an easy and optimized way. We can't quite 631 if not startrevs:
632 use "::head()" because that revset returns "::x + ::y + ..." for each head
633 in the repo (whereas we want "::x *and* ::y").
634
635 """
636 # only wants the heads of the set passed in
637 h = heads(repo, fullreposet(repo), x, anyorder)
638 if not h:
639 return baseset() 632 return baseset()
640 for r in h: 633 for r in startrevs:
641 subset &= dagop.revancestors(repo, baseset([r])) 634 subset &= dagop.revancestors(repo, baseset([r]))
642
643 return subset 635 return subset
644 636
645 @predicate('contains(pattern)', weight=100) 637 @predicate('contains(pattern)', weight=100)
646 def contains(repo, subset, x): 638 def contains(repo, subset, x):
647 """The revision's manifest contains a file matching pattern (but might not 639 """The revision's manifest contains a file matching pattern (but might not