# HG changeset patch # User Yuya Nishihara # Date 1530281603 -32400 # Node ID 54d7aaa243ccd8d7573fe2a0b917d28bfb2a8d2f # Parent c1a7bbf9984d2614bfac478d42c86377a84641ba revset: add partial support for ancestor(wdir()) It's easy, so let's make it happen. I'm not certain if 'wdir() &' should be required. ancestors(wdir()) works without it, but ancestor(wdir()) doesn't as of now. That's the issue of fullreposet.__contains__() vs __and__(). diff -r c1a7bbf9984d -r 54d7aaa243cc mercurial/revset.py --- a/mercurial/revset.py Sat Jun 23 13:19:03 2018 +0100 +++ b/mercurial/revset.py Fri Jun 29 23:13:23 2018 +0900 @@ -319,8 +319,9 @@ for r in reviter: anc = anc.ancestor(repo[r]) - if anc.rev() in subset: - return baseset([anc.rev()]) + r = scmutil.intrev(anc) + if r in subset: + return baseset([r]) return baseset() def _ancestors(repo, subset, x, followfirst=False, startdepth=None, diff -r c1a7bbf9984d -r 54d7aaa243cc tests/test-revset.t --- a/tests/test-revset.t Sat Jun 23 13:19:03 2018 +0100 +++ b/tests/test-revset.t Fri Jun 29 23:13:23 2018 +0900 @@ -1813,6 +1813,16 @@ 6 7 2147483647 + $ hg debugrevspec '0:wdir() & ancestor(wdir())' + 2147483647 + $ hg debugrevspec '0:wdir() & ancestor(.:wdir())' + 4 + $ hg debugrevspec '0:wdir() & ancestor(wdir(), wdir())' + 2147483647 + $ hg debugrevspec '0:wdir() & ancestor(wdir(), tip)' + 4 + $ hg debugrevspec 'null:wdir() & ancestor(wdir(), null)' + -1 $ hg debugrevspec 'wdir()~0' 2147483647 $ hg debugrevspec 'p1(wdir())'