# HG changeset patch # User Yuya Nishihara # Date 1471700278 -32400 # Node ID 7b17f9de6d3e3c3076337d5a06bc0e4753e9b4ef # Parent 55ff67ffcead4db87244fa8dcb366137674e377a revlog: map rev(wdirid) to WdirUnsupported exception This will allow us to map repo["ff..."] to workingctx. _partialmatch() will be updated later. I tried "return wdirrev" in place of raising the exception, but earlier exception seemed better. diff -r 55ff67ffcead -r 7b17f9de6d3e mercurial/revlog.py --- a/mercurial/revlog.py Sat Jun 03 19:12:01 2017 +0900 +++ b/mercurial/revlog.py Sat Aug 20 22:37:58 2016 +0900 @@ -26,6 +26,7 @@ hex, nullid, nullrev, + wdirid, wdirrev, ) from .i18n import _ @@ -416,6 +417,8 @@ raise except RevlogError: # parsers.c radix tree lookup failed + if node == wdirid: + raise error.WdirUnsupported raise LookupError(node, self.indexfile, _('no node')) except KeyError: # pure python cache lookup failed @@ -430,6 +433,8 @@ if v == node: self._nodepos = r - 1 return r + if node == wdirid: + raise error.WdirUnsupported raise LookupError(node, self.indexfile, _('no node')) # Accessors for index entries. diff -r 55ff67ffcead -r 7b17f9de6d3e mercurial/scmutil.py --- a/mercurial/scmutil.py Sat Jun 03 19:12:01 2017 +0900 +++ b/mercurial/scmutil.py Sat Aug 20 22:37:58 2016 +0900 @@ -190,6 +190,8 @@ if inst.hint: ui.warn(_("(%s)\n") % inst.hint) return 1 + except error.WdirUnsupported: + ui.warn(_("abort: working directory revision cannot be specified\n")) except error.Abort as inst: ui.warn(_("abort: %s\n") % inst) if inst.hint: diff -r 55ff67ffcead -r 7b17f9de6d3e tests/test-debugcommands.t --- a/tests/test-debugcommands.t Sat Jun 03 19:12:01 2017 +0900 +++ b/tests/test-debugcommands.t Sat Aug 20 22:37:58 2016 +0900 @@ -110,6 +110,12 @@ 7 6 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob) 8 7 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob) +Test WdirUnsupported exception + + $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff + abort: working directory revision cannot be specified + [255] + Test cache warming command $ rm -rf .hg/cache/