changeset 45217: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 4ebc5f325bed
children 27822b8436bf e3df1f560d9a
files mercurial/error.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/error.py	Fri Sep 11 14:41:05 2020 +0900
+++ b/mercurial/error.py	Sun Sep 13 15:59:23 2020 +0900
@@ -73,7 +73,10 @@
             from .node import short
 
             name = short(name)
-        RevlogError.__init__(self, b'%s@%s: %s' % (index, name, message))
+        # if name is a binary node, it can be None
+        RevlogError.__init__(
+            self, b'%s@%s: %s' % (index, pycompat.bytestr(name), message)
+        )
 
     def __bytes__(self):
         return RevlogError.__bytes__(self)