Mercurial > hg
changeset 32659:7b17f9de6d3e
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 20 Aug 2016 22:37:58 +0900 |
parents | 55ff67ffcead |
children | a722c8e17363 |
files | mercurial/revlog.py mercurial/scmutil.py tests/test-debugcommands.t |
diffstat | 3 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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.
--- 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:
--- 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/