Mercurial > public > mercurial-scm > hg
diff hgext/journal.py @ 36668:e77cee5de1c7
py3: use b"%d" to covert integer to bytes instead of str
Differential Revision: https://phab.mercurial-scm.org/D2618
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 02 Mar 2018 07:17:06 +0530 |
parents | bcfc4e3b6548 |
children | f0b6fbea00cf |
line wrap: on
line diff
--- 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)