[PATCH 4 of 8 py3] py3: wrap string constants in dagparser.py with bytestr()
Yuya Nishihara
yuya at tcha.org
Sat Sep 16 14:31:28 UTC 2017
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1504420119 -32400
# Sun Sep 03 15:28:39 2017 +0900
# Node ID 9df048c2b35e6c3528727c52ed710ec1fd997d2c
# Parent a3c836e6cd2f8cfcd9f4812ed7195d3d4496dc35
py3: wrap string constants in dagparser.py with bytestr()
diff --git a/mercurial/dagparser.py b/mercurial/dagparser.py
--- a/mercurial/dagparser.py
+++ b/mercurial/dagparser.py
@@ -13,6 +13,7 @@ import string
from .i18n import _
from . import (
error,
+ pycompat,
util,
)
@@ -158,7 +159,6 @@ def parsedag(desc):
Error:
- >>> from . import pycompat
>>> try: list(parsedag(b'+1 bad'))
... except Exception as e: print(pycompat.sysstr(bytes(e)))
invalid character in dag description: bad...
@@ -167,7 +167,7 @@ def parsedag(desc):
if not desc:
return
- wordchars = string.ascii_letters + string.digits
+ wordchars = pycompat.bytestr(string.ascii_letters + string.digits)
labels = {}
p1 = -1
@@ -176,7 +176,7 @@ def parsedag(desc):
def resolve(ref):
if not ref:
return p1
- elif ref[0] in string.digits:
+ elif ref[0] in pycompat.bytestr(string.digits):
return r - int(ref)
else:
return labels[ref]
@@ -210,7 +210,7 @@ def parsedag(desc):
c = nextch()
while c != '\0':
- while c in string.whitespace:
+ while c in pycompat.bytestr(string.whitespace):
c = nextch()
if c == '.':
yield 'n', (r, [p1])
@@ -218,7 +218,7 @@ def parsedag(desc):
r += 1
c = nextch()
elif c == '+':
- c, digs = nextrun(nextch(), string.digits)
+ c, digs = nextrun(nextch(), pycompat.bytestr(string.digits))
n = int(digs)
for i in xrange(0, n):
yield 'n', (r, [p1])
More information about the Mercurial-devel
mailing list