py3: use b"%d" to covert integer to bytes instead of str
Differential Revision: https://phab.mercurial-scm.org/D2618
--- a/hgext/journal.py Fri Mar 02 07:16:33 2018 +0530
+++ b/hgext/journal.py Fri Mar 02 07:17:06 2018 +0530
@@ -351,7 +351,7 @@
# Read just enough bytes to get a version number (up to 2
# digits plus separator)
version = f.read(3).partition('\0')[0]
- if version and version != str(storageversion):
+ if version and version != "%d" % storageversion:
# different version of the storage. Exit early (and not
# write anything) if this is not a version we can handle or
# the file is corrupt. In future, perhaps rotate the file
@@ -361,7 +361,7 @@
return
if not version:
# empty file, write version first
- f.write(str(storageversion) + '\0')
+ f.write(("%d" % storageversion) + '\0')
f.seek(0, os.SEEK_END)
f.write(bytes(entry) + '\0')
@@ -413,7 +413,7 @@
lines = raw.split('\0')
version = lines and lines[0]
- if version != str(storageversion):
+ if version != "%d" % storageversion:
version = version or _('not available')
raise error.Abort(_("unknown journal file version '%s'") % version)
--- a/hgext/mq.py Fri Mar 02 07:16:33 2018 +0530
+++ b/hgext/mq.py Fri Mar 02 07:17:06 2018 +0530
@@ -1932,7 +1932,7 @@
length = len(self.series) - start
if not missing:
if self.ui.verbose:
- idxwidth = len(str(start + length - 1))
+ idxwidth = len("%d" % (start + length - 1))
for i in xrange(start, start + length):
patch = self.series[i]
if patch in applied:
@@ -2098,7 +2098,7 @@
if not self.ui.verbose:
p = pname
else:
- p = str(self.series.index(pname)) + " " + pname
+ p = ("%d" % self.series.index(pname)) + " " + pname
return p
def qimport(self, repo, files, patchname=None, rev=None, existing=None,
--- a/hgext/patchbomb.py Fri Mar 02 07:16:33 2018 +0530
+++ b/hgext/patchbomb.py Fri Mar 02 07:17:06 2018 +0530
@@ -212,7 +212,7 @@
if not numbered:
return '[PATCH%s]' % flag
else:
- tlen = len(str(total))
+ tlen = len("%d" % total)
return '[PATCH %0*d of %d%s]' % (tlen, idx, total, flag)
def makepatch(ui, repo, rev, patchlines, opts, _charsets, idx, total, numbered,
@@ -630,7 +630,7 @@
if outgoing:
revs = _getoutgoing(repo, dest, revs)
if bundle:
- opts['revs'] = [str(r) for r in revs]
+ opts['revs'] = ["%d" % r for r in revs]
# check if revision exist on the public destination
publicurl = repo.ui.config('patchbomb', 'publicurl')
--- a/hgext/schemes.py Fri Mar 02 07:16:33 2018 +0530
+++ b/hgext/schemes.py Fri Mar 02 07:17:06 2018 +0530
@@ -94,7 +94,7 @@
parts = parts[:-1]
else:
tail = ''
- context = dict((str(i + 1), v) for i, v in enumerate(parts))
+ context = dict(('%d' % (i + 1), v) for i, v in enumerate(parts))
return ''.join(self.templater.process(self.url, context)) + tail
def hasdriveletter(orig, path):