[PATCH 3 of 4 V2] py3: use pycompat.bytestr instead of bytes

Pulkit Goyal 7895pulkit at gmail.com
Thu May 4 18:40:17 EDT 2017


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1493927809 -19800
#      Fri May 05 01:26:49 2017 +0530
# Node ID c442d698765059a6afa6db3361844e3cc8709d7d
# Parent  40e57ce475231ba494c8c0a9cf8f0278411d0c38
py3: use pycompat.bytestr instead of bytes

diff -r 40e57ce47523 -r c442d6987650 mercurial/templater.py
--- a/mercurial/templater.py	Fri May 05 01:26:13 2017 +0530
+++ b/mercurial/templater.py	Fri May 05 01:26:49 2017 +0530
@@ -53,6 +53,7 @@
     """Parse a template expression into a stream of tokens, which must end
     with term if specified"""
     pos = start
+    program = pycompat.bytestr(program)
     while pos < end:
         c = program[pos]
         if c.isspace(): # skip inter-token whitespace
diff -r 40e57ce47523 -r c442d6987650 mercurial/util.py
--- a/mercurial/util.py	Fri May 05 01:26:13 2017 +0530
+++ b/mercurial/util.py	Fri May 05 01:26:49 2017 +0530
@@ -1913,6 +1913,7 @@
     # add missing elements from defaults
     usenow = False # default to using biased defaults
     for part in ("S", "M", "HI", "d", "mb", "yY"): # decreasing specificity
+        part = pycompat.bytestr(part)
         found = [True for p in part if ("%"+p) in format]
         if not found:
             date += "@" + defaults[part][usenow]
@@ -2038,6 +2039,7 @@
     False
     """
 
+    date = pycompat.bytestr(date)
     def lower(date):
         d = {'mb': "1", 'd': "1"}
         return parsedate(date, extendeddateformats, d)[0]


More information about the Mercurial-devel mailing list