Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 38705:e4b270a32ba8
revset: special case commonancestors(none()) to be empty set
This matches the behavior of ancestor(none()).
From an implementation perspective, ancestor() and commonancestors() are
intersection, and ancestors() is union, so it would make some sense that
commonancestors(none()) returned all revisions. However, ancestor(none())
isn't implemented as such, which breaks ancestor(x) == max(commonancestors(x)).
From a user perspective, ancestors of nothing is nothing whichever type
of operation the ancestor predicate does.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 12 Jul 2018 23:07:29 +0900 |
parents | 607e2a2501e6 |
children | cb5134f2318a 4fe8d1f077b8 |
comparison
equal
deleted
inserted
replaced
38704:607e2a2501e6 | 38705:e4b270a32ba8 |
---|---|
630 use "::head()" because that revset returns "::x + ::y + ..." for each head | 630 use "::head()" because that revset returns "::x + ::y + ..." for each head |
631 in the repo (whereas we want "::x *and* ::y"). | 631 in the repo (whereas we want "::x *and* ::y"). |
632 | 632 |
633 """ | 633 """ |
634 # only wants the heads of the set passed in | 634 # only wants the heads of the set passed in |
635 for r in heads(repo, fullreposet(repo), x, anyorder): | 635 h = heads(repo, fullreposet(repo), x, anyorder) |
636 if not h: | |
637 return baseset() | |
638 for r in h: | |
636 subset &= dagop.revancestors(repo, baseset([r])) | 639 subset &= dagop.revancestors(repo, baseset([r])) |
637 | 640 |
638 return subset | 641 return subset |
639 | 642 |
640 @predicate('contains(pattern)', weight=100) | 643 @predicate('contains(pattern)', weight=100) |