D2942: revlog: detect pseudo file nodeids to raise WdirUnsupported exception
yuja (Yuya Nishihara)
phabricator at mercurial-scm.org
Sun Mar 25 09:54:14 UTC 2018
yuja created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Again, I'm not sure if this is the right thing, but adding a few more pseudo
hashes wouldn't be any worse than the current state.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2942
AFFECTED FILES
mercurial/revlog.py
tests/test-grep.t
CHANGE DETAILS
diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -245,7 +245,7 @@
$ hg stat
M port2
$ hg grep -r 'wdir()' port
- abort: data/port2.i at 303030303030: no node!
+ abort: working directory revision cannot be specified
[255]
$ cd ..
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -28,6 +28,7 @@
hex,
nullid,
nullrev,
+ wdirfilenodeids,
wdirhex,
wdirid,
wdirrev,
@@ -780,7 +781,7 @@
raise
except RevlogError:
# parsers.c radix tree lookup failed
- if node == wdirid:
+ if node == wdirid or node in wdirfilenodeids:
raise error.WdirUnsupported
raise LookupError(node, self.indexfile, _('no node'))
except KeyError:
@@ -796,7 +797,7 @@
if v == node:
self._nodepos = r - 1
return r
- if node == wdirid:
+ if node == wdirid or node in wdirfilenodeids:
raise error.WdirUnsupported
raise LookupError(node, self.indexfile, _('no node'))
@@ -1409,6 +1410,7 @@
pass
def _partialmatch(self, id):
+ # we don't care wdirfilenodeids as they should be always full hash
maybewdir = wdirhex.startswith(id)
try:
partial = self.index.partialmatch(id)
@@ -2082,7 +2084,7 @@
if node == nullid:
raise RevlogError(_("%s: attempt to add null revision") %
(self.indexfile))
- if node == wdirid:
+ if node == wdirid or node in wdirfilenodeids:
raise RevlogError(_("%s: attempt to add wdir revision") %
(self.indexfile))
To: yuja, indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list