comparison contrib/dirstatenonnormalcheck.py @ 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 ff97e793ed36
comparison
equal deleted inserted replaced
47546:35295f5a5b9f 47547:20b37ef33ebc
9 from __future__ import absolute_import 9 from __future__ import absolute_import
10 10
11 from mercurial import ( 11 from mercurial import (
12 dirstate, 12 dirstate,
13 extensions, 13 extensions,
14 pycompat,
14 ) 15 )
15 16
16 17
17 def nonnormalentries(dmap): 18 def nonnormalentries(dmap):
18 """Compute nonnormal entries from dirstate's dmap""" 19 """Compute nonnormal entries from dirstate's dmap"""
25 26
26 def checkconsistency(ui, orig, dmap, _nonnormalset, label): 27 def checkconsistency(ui, orig, dmap, _nonnormalset, label):
27 """Compute nonnormalset from dmap, check that it matches _nonnormalset""" 28 """Compute nonnormalset from dmap, check that it matches _nonnormalset"""
28 nonnormalcomputedmap = nonnormalentries(dmap) 29 nonnormalcomputedmap = nonnormalentries(dmap)
29 if _nonnormalset != nonnormalcomputedmap: 30 if _nonnormalset != nonnormalcomputedmap:
30 ui.develwarn(b"%s call to %s\n" % (label, orig), config=b'dirstate') 31 b_orig = pycompat.sysbytes(repr(orig))
32 ui.develwarn(b"%s call to %s\n" % (label, b_orig), config=b'dirstate')
31 ui.develwarn(b"inconsistency in nonnormalset\n", config=b'dirstate') 33 ui.develwarn(b"inconsistency in nonnormalset\n", config=b'dirstate')
32 ui.develwarn(b"[nonnormalset] %s\n" % _nonnormalset, config=b'dirstate') 34 b_nonnormal = pycompat.sysbytes(repr(_nonnormalset))
33 ui.develwarn(b"[map] %s\n" % nonnormalcomputedmap, config=b'dirstate') 35 ui.develwarn(b"[nonnormalset] %s\n" % b_nonnormal, config=b'dirstate')
36 b_nonnormalcomputed = pycompat.sysbytes(repr(nonnormalcomputedmap))
37 ui.develwarn(b"[map] %s\n" % b_nonnormalcomputed, config=b'dirstate')
34 38
35 39
36 def _checkdirstate(orig, self, arg): 40 def _checkdirstate(orig, self, arg):
37 """Check nonnormal set consistency before and after the call to orig""" 41 """Check nonnormal set consistency before and after the call to orig"""
38 checkconsistency( 42 checkconsistency(