Patchwork D2940: workingctx: build _manifest on filenode() or flags() request

login
register
mail settings
Submitter phabricator
Date April 7, 2018, 1:54 a.m.
Message ID <cb697c87f99e700491dec1a2a01ce7de@localhost.localdomain>
Download mbox | patch
Permalink /patch/30512/
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 rHG067e8d1178a2: workingctx: build _manifest on filenode() or flags() request (authored by yuja, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2940?vs=7281&id=7853

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

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

CHANGE DETAILS




To: yuja, #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
@@ -237,6 +237,17 @@ 
   $ hg grep -f port
   [1]
 
+Test wdir
+(at least, this shouldn't crash)
+
+  $ hg up -q
+  $ echo wport >> port2
+  $ hg stat
+  M port2
+  $ hg grep -r 'wdir()' port
+  abort: data/port2.i@303030303030: no node!
+  [255]
+
   $ cd ..
   $ hg init t2
   $ cd t2
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1330,6 +1330,11 @@ 
             p = p[:-1]
         return [changectx(self._repo, x) for x in p]
 
+    def _fileinfo(self, path):
+        # populate __dict__['_manifest'] as workingctx has no _manifestdelta
+        self._manifest
+        return super(workingctx, self)._fileinfo(path)
+
     def filectx(self, path, filelog=None):
         """get a file context from the working directory"""
         return workingfilectx(self._repo, path, workingctx=self,