Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 45489:a108f7ff7778
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
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 17 Sep 2020 09:56:05 -0700 |
parents | 1476ec96965f |
children | 19590b126764 |
comparison
equal
deleted
inserted
replaced
45488:c4f14db3da1d | 45489:a108f7ff7778 |
---|---|
269 if '_manifest' in self.__dict__: | 269 if '_manifest' in self.__dict__: |
270 try: | 270 try: |
271 return self._manifest.find(path) | 271 return self._manifest.find(path) |
272 except KeyError: | 272 except KeyError: |
273 raise error.ManifestLookupError( | 273 raise error.ManifestLookupError( |
274 self._node, path, _(b'not found in manifest') | 274 self._node or b'None', path, _(b'not found in manifest') |
275 ) | 275 ) |
276 if '_manifestdelta' in self.__dict__ or path in self.files(): | 276 if '_manifestdelta' in self.__dict__ or path in self.files(): |
277 if path in self._manifestdelta: | 277 if path in self._manifestdelta: |
278 return ( | 278 return ( |
279 self._manifestdelta[path], | 279 self._manifestdelta[path], |
282 mfl = self._repo.manifestlog | 282 mfl = self._repo.manifestlog |
283 try: | 283 try: |
284 node, flag = mfl[self._changeset.manifest].find(path) | 284 node, flag = mfl[self._changeset.manifest].find(path) |
285 except KeyError: | 285 except KeyError: |
286 raise error.ManifestLookupError( | 286 raise error.ManifestLookupError( |
287 self._node, path, _(b'not found in manifest') | 287 self._node or b'None', path, _(b'not found in manifest') |
288 ) | 288 ) |
289 | 289 |
290 return node, flag | 290 return node, flag |
291 | 291 |
292 def filenode(self, path): | 292 def filenode(self, path): |