Mercurial > hg
changeset 32661:a3064fe3e495
revset: add support for integer and hex wdir identifiers
As I said before, partial 'ff...' hash isn't supported yet.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 03 Jun 2017 20:39:33 +0900 |
parents | a722c8e17363 |
children | 9d201b39ccd9 |
files | mercurial/revset.py tests/test-revset.t |
diffstat | 2 files changed, 23 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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])
--- 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