Patchwork D272: bundle2: convert ints to strings using pycompat.bytestring()

login
register
mail settings
Submitter phabricator
Date Aug. 8, 2017, 7:49 p.m.
Message ID <differential-rev-PHID-DREV-cdnfc6amk4tme57kklsb-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/22764/
State Superseded
Headers show

Comments

phabricator - Aug. 8, 2017, 7:49 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D272

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -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()