Mercurial > hg
changeset 38479:72621094505f
revset: fix heads() order to always follow the input set (BC)
An argument expression should never affect the order of the result set.
That's the rule of the revset predicates.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 27 Jun 2018 23:39:41 +0900 |
parents | b2d5ad03f31a |
children | ecaa0ad4ed4f |
files | mercurial/revset.py tests/test-revset.t |
diffstat | 2 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Wed Jun 27 23:33:57 2018 +0900 +++ b/mercurial/revset.py Wed Jun 27 23:39:41 2018 +0900 @@ -1129,11 +1129,14 @@ hs.update(cl.rev(h) for h in ls) return subset & baseset(hs) -@predicate('heads(set)', safe=True) -def heads(repo, subset, x): +@predicate('heads(set)', safe=True, takeorder=True) +def heads(repo, subset, x, order): """Members of set with no children in set. """ - s = getset(repo, subset, x) + # argument set should never define order + if order == defineorder: + order = followorder + s = getset(repo, subset, x, order=order) ps = parents(repo, subset, x) return s - ps
--- a/tests/test-revset.t Wed Jun 27 23:33:57 2018 +0900 +++ b/tests/test-revset.t Wed Jun 27 23:39:41 2018 +0900 @@ -1376,20 +1376,20 @@ <baseset [9]>, set([0, 1, 2, 3, 4, 5, 6, 8])>>> 9 - BROKEN: but should follow the order of the subset + but should follow the order of the subset $ log 'heads(all())' 7 9 $ log 'heads(tip:0)' + 7 9 - 7 $ log 'tip:0 & heads(all())' 9 7 $ log 'tip:0 & heads(0:tip)' + 9 7 - 9 $ log 'keyword(issue)' 6