comparison mercurial/revlog.py @ 42629:24111fb9a725

lookup: don't use "00changelog.i@None" when lookup of prefix fails We were shadowing the "node" variable, so we always passed None to the LookupError instead of the node we meant to pass. (This showed up in py3 tests since py3 doesn't like to format None using "%s".) Differential Revision: https://phab.mercurial-scm.org/D6661
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 19 Jul 2019 09:43:50 -0700
parents 4eaf7197a740
children 716d575df275
comparison
equal deleted inserted replaced
42628:eb27d9eee2cc 42629:24111fb9a725
1353 1353
1354 def shortest(self, node, minlength=1): 1354 def shortest(self, node, minlength=1):
1355 """Find the shortest unambiguous prefix that matches node.""" 1355 """Find the shortest unambiguous prefix that matches node."""
1356 def isvalid(prefix): 1356 def isvalid(prefix):
1357 try: 1357 try:
1358 node = self._partialmatch(prefix) 1358 matchednode = self._partialmatch(prefix)
1359 except error.AmbiguousPrefixLookupError: 1359 except error.AmbiguousPrefixLookupError:
1360 return False 1360 return False
1361 except error.WdirUnsupported: 1361 except error.WdirUnsupported:
1362 # single 'ff...' match 1362 # single 'ff...' match
1363 return True 1363 return True
1364 if node is None: 1364 if matchednode is None:
1365 raise error.LookupError(node, self.indexfile, _('no node')) 1365 raise error.LookupError(node, self.indexfile, _('no node'))
1366 return True 1366 return True
1367 1367
1368 def maybewdir(prefix): 1368 def maybewdir(prefix):
1369 return all(c == 'f' for c in pycompat.iterbytestr(prefix)) 1369 return all(c == 'f' for c in pycompat.iterbytestr(prefix))