Patchwork D2942: revlog: detect pseudo file nodeids to raise WdirUnsupported exception

login
register
mail settings
Submitter phabricator
Date April 7, 2018, 1:54 a.m.
Message ID <62392c6963aeb8a552edc63b6d659105@localhost.localdomain>
Download mbox | patch
Permalink /patch/30514/
State Not Applicable
Headers show

Comments

phabricator - April 7, 2018, 1:54 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa0d71618074f: revlog: detect pseudo file nodeids to raise WdirUnsupported exception (authored by yuja, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2942?vs=7283&id=7855

REVISION DETAIL
  https://phab.mercurial-scm.org/D2942

AFFECTED FILES
  mercurial/revlog.py
  tests/test-grep.t

CHANGE DETAILS




To: yuja, indygreg, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

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@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
@@ -29,6 +29,7 @@ 
     hex,
     nullid,
     nullrev,
+    wdirfilenodeids,
     wdirhex,
     wdirid,
     wdirrev,
@@ -807,7 +808,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:
@@ -823,7 +824,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'))
 
@@ -1436,6 +1437,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)
@@ -2114,7 +2116,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))