# HG changeset patch # User Yuya Nishihara # Date 1521970063 -32400 # Node ID 067e8d1178a230df81ef2f99fedc280f9c21249a # Parent d46d4f14300a89396aeede8f49793b80767d2992 workingctx: build _manifest on filenode() or flags() request I'm not sure if this is the best workaround, but this fixes the following exception: AttributeError: 'workingctx' object has no attribute '_manifestdelta' The short hash '303030303030' seen in the test is node.modifiednodeid. Differential Revision: https://phab.mercurial-scm.org/D2940 diff -r d46d4f14300a -r 067e8d1178a2 mercurial/context.py --- a/mercurial/context.py Fri Apr 06 13:11:40 2018 -0700 +++ b/mercurial/context.py Sun Mar 25 18:27:43 2018 +0900 @@ -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, diff -r d46d4f14300a -r 067e8d1178a2 tests/test-grep.t --- a/tests/test-grep.t Fri Apr 06 13:11:40 2018 -0700 +++ b/tests/test-grep.t Sun Mar 25 18:27:43 2018 +0900 @@ -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