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

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Sat Apr 7 01:54:15 UTC 2018


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

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 at 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,



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


More information about the Mercurial-devel mailing list