[PATCH 4 of 5] py3: byteify contrib/check-config.py
Matt Harbison
mharbison72 at gmail.com
Wed Sep 19 08:03:56 EDT 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1537329398 14400
# Tue Sep 18 23:56:38 2018 -0400
# Node ID 23d4f40c37602052e17661d58f2bbe3fb26c66ce
# Parent 121c7ecc6a829a49bb6602cf5049dd802af69626
py3: byteify contrib/check-config.py
The corresponding *.t still fails because of bytes (with a 'b' prefix) vs str
printing, but no longer crashes.
# skip-blame for b'' prefixing
diff --git a/contrib/check-config.py b/contrib/check-config.py
--- a/contrib/check-config.py
+++ b/contrib/check-config.py
@@ -104,12 +104,12 @@ def main(args):
ctype = m.group('ctype')
if not ctype:
ctype = 'str'
- name = m.group('section') + "." + m.group('option')
+ name = m.group('section') + b"." + m.group('option')
default = m.group('default')
if default in (None, 'False', 'None', '0', '[]', '""', "''"):
- default = ''
+ default = b''
if re.match(b'[a-z.]+$', default):
- default = '<variable>'
+ default = b'<variable>'
if (name in foundopts and (ctype, default) != foundopts[name]
and name not in allowinconsistent):
print(l.rstrip())
@@ -117,19 +117,19 @@ def main(args):
foundopts[name]))
print("at %s:%d:" % (f, linenum))
foundopts[name] = (ctype, default)
- carryover = ''
+ carryover = b''
else:
m = re.search(configpartialre, line)
if m:
carryover = line
else:
- carryover = ''
+ carryover = b''
for name in sorted(foundopts):
if name not in documented:
- if not (name.startswith("devel.") or
- name.startswith("experimental.") or
- name.startswith("debug.")):
+ if not (name.startswith(b"devel.") or
+ name.startswith(b"experimental.") or
+ name.startswith(b"debug.")):
ctype, default = foundopts[name]
if default:
default = ' [%s]' % default
More information about the Mercurial-devel
mailing list