bundle2: convert ints to strings using pycompat.bytestring()
authorAugie Fackler <augie@google.com>
Mon, 24 Jul 2017 11:16:32 -0400
changeset 33711 373ca5103ba8
parent 33710 2e43c5cd57a7
child 33712 672ad4f3bb84
bundle2: convert ints to strings using pycompat.bytestring() Fixes some Python 3 regressions. We don't use %d here because the part id is actually an Optional[int]. It should always be initialized to a non-None value by the time this code executes, but we shouldn't blindly depend on that being the case. Differential Revision: https://phab.mercurial-scm.org/D272
mercurial/bundle2.py
--- a/mercurial/bundle2.py	Tue Aug 08 15:07:05 2017 -0400
+++ b/mercurial/bundle2.py	Mon Jul 24 11:16:32 2017 -0400
@@ -1000,7 +1000,7 @@
             parttype = self.type.upper()
         else:
             parttype = self.type.lower()
-        outdebug(ui, 'part %s: "%s"' % (self.id, parttype))
+        outdebug(ui, 'part %s: "%s"' % (pycompat.bytestr(self.id), parttype))
         ## parttype
         header = [_pack(_fparttypesize, len(parttype)),
                   parttype, _pack(_fpartid, self.id),
@@ -1239,7 +1239,7 @@
         self.type = self._fromheader(typesize)
         indebug(self.ui, 'part type: "%s"' % self.type)
         self.id = self._unpackheader(_fpartid)[0]
-        indebug(self.ui, 'part id: "%s"' % self.id)
+        indebug(self.ui, 'part id: "%s"' % pycompat.bytestr(self.id))
         # extract mandatory bit from type
         self.mandatory = (self.type != self.type.lower())
         self.type = self.type.lower()