comparison mercurial/error.py @ 45503:bd5b2b29b82d stable

py3: fix formatting of LookupError for workingctx Spotted while writing broken tests for "hg grep -fr'wdir()'". basectx._fileinfo() raises ManifestLookupError(self._node, ..), but _node of the workingctx is None for historical reasons.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 13 Sep 2020 15:59:23 +0900
parents e429e7c801b2
children bdd2cdf9e248
comparison
equal deleted inserted replaced
45416:4ebc5f325bed 45503:bd5b2b29b82d
71 self.lookupmessage = message 71 self.lookupmessage = message
72 if isinstance(name, bytes) and len(name) == 20: 72 if isinstance(name, bytes) and len(name) == 20:
73 from .node import short 73 from .node import short
74 74
75 name = short(name) 75 name = short(name)
76 RevlogError.__init__(self, b'%s@%s: %s' % (index, name, message)) 76 # if name is a binary node, it can be None
77 RevlogError.__init__(
78 self, b'%s@%s: %s' % (index, pycompat.bytestr(name), message)
79 )
77 80
78 def __bytes__(self): 81 def __bytes__(self):
79 return RevlogError.__bytes__(self) 82 return RevlogError.__bytes__(self)
80 83
81 def __str__(self): 84 def __str__(self):