# HG changeset patch # User Yuya Nishihara # Date 2019-04-30 06:15:57 # Node ID 6bc1245cd5989106b4784cdf4e089b5e6ae5001f # Parent a0c5e06e9b1a2c04f2393801022ab37c5c900cf1 revset: populate wdir() by its hash or revision number It belongs to the same category as the null hash/revision, and we do handle these virtual identifiers in id()/rev() predicates. Let's do that more consistently. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -123,8 +123,7 @@ def stringset(repo, subset, x, order): if not x: raise error.ParseError(_("empty string is not a valid revision")) x = scmutil.intrev(scmutil.revsymbol(repo, x)) - if (x in subset - or x == node.nullrev and isinstance(subset, fullreposet)): + if x in subset or x in _virtualrevs and isinstance(subset, fullreposet): return baseset([x]) return baseset() @@ -2265,7 +2264,7 @@ def _orderedlist(repo, subset, x): if r in seen: continue if (r in subset - or r == node.nullrev and isinstance(subset, fullreposet)): + or r in _virtualrevs and isinstance(subset, fullreposet)): ls.append(r) seen.add(r) return baseset(ls) diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -1956,25 +1956,26 @@ For tests consistency 2147483647 Test working-directory integer revision and node id -(BUG: '0:wdir()' is still needed to populate wdir revision) - $ hg debugrevspec '0:wdir() & 2147483647' + $ hg debugrevspec '2147483647' 2147483647 - $ hg debugrevspec '0:wdir() & rev(2147483647)' + $ hg debugrevspec 'rev(2147483647)' + 2147483647 + $ hg debugrevspec 'ffffffffffffffffffffffffffffffffffffffff' 2147483647 - $ hg debugrevspec '0:wdir() & ffffffffffffffffffffffffffffffffffffffff' + $ hg debugrevspec 'ffffffffffff' 2147483647 - $ hg debugrevspec '0:wdir() & ffffffffffff' + $ hg debugrevspec 'id(ffffffffffffffffffffffffffffffffffffffff)' 2147483647 - $ hg debugrevspec '0:wdir() & id(ffffffffffffffffffffffffffffffffffffffff)' + $ hg debugrevspec 'id(ffffffffffff)' 2147483647 - $ hg debugrevspec '0:wdir() & id(ffffffffffff)' + $ hg debugrevspec 'ffffffffffff+000000000000' 2147483647 + -1 $ cd .. Test short 'ff...' hash collision -(BUG: '0:wdir()' is still needed to populate wdir revision) $ hg init wdir-hashcollision $ cd wdir-hashcollision @@ -2000,21 +2001,21 @@ Test short 'ff...' hash collision $ hg debugobsolete fffbae3886c8fbb2114296380d276fd37715d571 obsoleted 1 changesets - $ hg debugrevspec '0:wdir() & fff' + $ hg debugrevspec 'fff' abort: 00changelog.i@fff: ambiguous identifier! [255] - $ hg debugrevspec '0:wdir() & ffff' + $ hg debugrevspec 'ffff' abort: 00changelog.i@ffff: ambiguous identifier! [255] - $ hg debugrevspec '0:wdir() & fffb' + $ hg debugrevspec 'fffb' abort: 00changelog.i@fffb: ambiguous identifier! [255] BROKEN should be '2' (node lookup uses unfiltered repo) - $ hg debugrevspec '0:wdir() & id(fffb)' + $ hg debugrevspec 'id(fffb)' BROKEN should be '2' (node lookup uses unfiltered repo) - $ hg debugrevspec '0:wdir() & ffff8' + $ hg debugrevspec 'ffff8' 4 - $ hg debugrevspec '0:wdir() & fffff' + $ hg debugrevspec 'fffff' 2147483647 $ cd ..