# HG changeset patch # User Yuya Nishihara # Date 1496489973 -32400 # Node ID a3064fe3e49577e47ea67c4de0cb3700fd640cba # Parent a722c8e173634cc6dfe70cf6724ac3bdf9db8efb revset: add support for integer and hex wdir identifiers As I said before, partial 'ff...' hash isn't supported yet. diff -r a722c8e17363 -r a3064fe3e495 mercurial/revset.py --- a/mercurial/revset.py Fri Aug 19 18:40:35 2016 +0900 +++ b/mercurial/revset.py Sat Jun 03 20:39:33 2017 +0900 @@ -24,6 +24,7 @@ registrar, repoview, revsetlang, + scmutil, smartset, util, ) @@ -190,7 +191,7 @@ # operator methods def stringset(repo, subset, x): - x = repo[x].rev() + x = scmutil.intrev(repo[x]) if (x in subset or x == node.nullrev and isinstance(subset, fullreposet)): return baseset([x]) @@ -1297,13 +1298,18 @@ if len(n) == 40: try: rn = repo.changelog.rev(node.bin(n)) + except error.WdirUnsupported: + rn = node.wdirrev except (LookupError, TypeError): rn = None else: rn = None pm = repo.changelog._partialmatch(n) if pm is not None: - rn = repo.changelog.rev(pm) + try: + rn = repo.changelog.rev(pm) + except error.WdirUnsupported: + rn = node.wdirrev if rn is None: return baseset() @@ -1620,7 +1626,7 @@ except (TypeError, ValueError): # i18n: "rev" is a keyword raise error.ParseError(_("rev expects a number")) - if l not in repo.changelog and l != node.nullrev: + if l not in repo.changelog and l not in (node.nullrev, node.wdirrev): return baseset() return subset & baseset([l]) diff -r a722c8e17363 -r a3064fe3e495 tests/test-revset.t --- a/tests/test-revset.t Fri Aug 19 18:40:35 2016 +0900 +++ b/tests/test-revset.t Sat Jun 03 20:39:33 2017 +0900 @@ -1280,6 +1280,20 @@ $ log '(all() + wdir()) & last(. + wdir())' 2147483647 +Test working-directory integer revision and node id +(BUG: '0:wdir()' is still needed to populate wdir revision) + + $ hg debugrevspec '0:wdir() & 2147483647' + 2147483647 + $ hg debugrevspec '0:wdir() & rev(2147483647)' + 2147483647 + $ hg debugrevspec '0:wdir() & ffffffffffffffffffffffffffffffffffffffff' + 2147483647 + $ hg debugrevspec '0:wdir() & id(ffffffffffffffffffffffffffffffffffffffff)' + 2147483647 + $ hg debugrevspec '0:wdir() & id(ffffffffffff)' +BROKEN: should be '2147483647' + $ log 'outgoing()' 8 9