##// END OF EJS Templates
merge with stable
Yuya Nishihara -
r39864:85a474ad merge default
parent child Browse files
Show More
@@ -616,30 +616,22 b' def _commonancestorheads(repo, subset, x'
616 616 # This is an internal method is for quickly calculating "heads(::x and
617 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 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 624 return subset & baseset(ancs)
625 625
626 626 @predicate('commonancestors(set)', safe=True)
627 627 def commonancestors(repo, subset, x):
628 """Returns all common ancestors of the set.
629
630 This method is for calculating "::x and ::y" (i.e. all the ancestors that
631 are common to both x and y) in an easy and optimized way. We can't quite
632 use "::head()" because that revset returns "::x + ::y + ..." for each head
633 in the repo (whereas we want "::x *and* ::y").
634
628 """Changesets that are ancestors of every changeset in set.
635 629 """
636 # only wants the heads of the set passed in
637 h = heads(repo, fullreposet(repo), x, anyorder)
638 if not h:
630 startrevs = getset(repo, fullreposet(repo), x, order=anyorder)
631 if not startrevs:
639 632 return baseset()
640 for r in h:
633 for r in startrevs:
641 634 subset &= dagop.revancestors(repo, baseset([r]))
642
643 635 return subset
644 636
645 637 @predicate('contains(pattern)', weight=100)
@@ -1049,7 +1049,7 b' test common ancestors'
1049 1049 2
1050 1050 4
1051 1051
1052 $ hg log -T '{rev}\n' -r 'commonancestors(head())'
1052 $ hg log -T '{rev}\n' -r 'commonancestors(heads(all()))'
1053 1053 0
1054 1054 1
1055 1055 2
@@ -1063,11 +1063,31 b' test common ancestors'
1063 1063 8
1064 1064 9
1065 1065
1066 $ hg log -T '{rev}\n' -r 'commonancestors(8 + 9)'
1067 0
1068 1
1069 2
1070 4
1071 8
1072
1073 test the specialized implementation of heads(commonancestors(..))
1074 (2 gcas is tested in test-merge-criss-cross.t)
1075
1076 $ hg log -T '{rev}\n' -r 'heads(commonancestors(7 + 9))'
1077 4
1078 $ hg log -T '{rev}\n' -r 'heads(commonancestors(heads(all())))'
1079 4
1080 $ hg log -T '{rev}\n' -r 'heads(commonancestors(9))'
1081 9
1082 $ hg log -T '{rev}\n' -r 'heads(commonancestors(8 + 9))'
1083 8
1084
1066 1085 test ancestor variants of empty revision
1067 1086
1068 1087 $ log 'ancestor(none())'
1069 1088 $ log 'ancestors(none())'
1070 1089 $ log 'commonancestors(none())'
1090 $ log 'heads(commonancestors(none()))'
1071 1091
1072 1092 test ancestors with depth limit
1073 1093
General Comments 0
You need to be logged in to leave comments. Login now