Patchwork D10993: dirstatenonnormalcheck: fix some bytes formating on python3

login
register
mail settings
Submitter phabricator
Date July 5, 2021, 9:35 a.m.
Message ID <differential-rev-PHID-DREV-z4gxlneazmgcl7ncgosr-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49305/
State Superseded
Headers show

Comments

phabricator - July 5, 2021, 9:35 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Passing any object to `%s` no longer works, we need to explicitely convert the
  representation to bytes.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10993

AFFECTED FILES
  contrib/dirstatenonnormalcheck.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/contrib/dirstatenonnormalcheck.py b/contrib/dirstatenonnormalcheck.py
--- a/contrib/dirstatenonnormalcheck.py
+++ b/contrib/dirstatenonnormalcheck.py
@@ -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):