py3: don't risk passing a None value to error.ManifestLookupError()
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 17 Sep 2020 09:56:05 -0700
changeset 45489 a108f7ff7778
parent 45488 c4f14db3da1d
child 45490 0ce6af73f481
py3: don't risk passing a None value to error.ManifestLookupError() This makes the test case added in 20dd2a259b0f (test-grep: add tests for --follow with/without --diff and/or paths, 2020-09-11) pass on Python 3. Differential Revision: https://phab.mercurial-scm.org/D9030
mercurial/context.py
--- a/mercurial/context.py	Thu Sep 03 13:25:29 2020 +0530
+++ b/mercurial/context.py	Thu Sep 17 09:56:05 2020 -0700
@@ -271,7 +271,7 @@
                 return self._manifest.find(path)
             except KeyError:
                 raise error.ManifestLookupError(
-                    self._node, path, _(b'not found in manifest')
+                    self._node or b'None', path, _(b'not found in manifest')
                 )
         if '_manifestdelta' in self.__dict__ or path in self.files():
             if path in self._manifestdelta:
@@ -284,7 +284,7 @@
             node, flag = mfl[self._changeset.manifest].find(path)
         except KeyError:
             raise error.ManifestLookupError(
-                self._node, path, _(b'not found in manifest')
+                self._node or b'None', path, _(b'not found in manifest')
             )
 
         return node, flag