changeset 47547:20b37ef33ebc

dirstatenonnormalcheck: fix some bytes formating on python3 Passing any object to `%s` no longer works, we need to explicitely convert the representation to bytes. Differential Revision: https://phab.mercurial-scm.org/D10993
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 05 Jul 2021 06:39:29 +0200
parents 35295f5a5b9f
children 5830539c46be
files contrib/dirstatenonnormalcheck.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/dirstatenonnormalcheck.py	Mon Jul 05 06:38:58 2021 +0200
+++ b/contrib/dirstatenonnormalcheck.py	Mon Jul 05 06:39:29 2021 +0200
@@ -11,6 +11,7 @@
 from mercurial import (
     dirstate,
     extensions,
+    pycompat,
 )
 
 
@@ -27,10 +28,13 @@
     """Compute nonnormalset from dmap, check that it matches _nonnormalset"""
     nonnormalcomputedmap = nonnormalentries(dmap)
     if _nonnormalset != nonnormalcomputedmap:
-        ui.develwarn(b"%s call to %s\n" % (label, orig), config=b'dirstate')
+        b_orig = pycompat.sysbytes(repr(orig))
+        ui.develwarn(b"%s call to %s\n" % (label, b_orig), config=b'dirstate')
         ui.develwarn(b"inconsistency in nonnormalset\n", config=b'dirstate')
-        ui.develwarn(b"[nonnormalset] %s\n" % _nonnormalset, config=b'dirstate')
-        ui.develwarn(b"[map] %s\n" % nonnormalcomputedmap, config=b'dirstate')
+        b_nonnormal = pycompat.sysbytes(repr(_nonnormalset))
+        ui.develwarn(b"[nonnormalset] %s\n" % b_nonnormal, config=b'dirstate')
+        b_nonnormalcomputed = pycompat.sysbytes(repr(nonnormalcomputedmap))
+        ui.develwarn(b"[map] %s\n" % b_nonnormalcomputed, config=b'dirstate')
 
 
 def _checkdirstate(orig, self, arg):