Mercurial > hg-stable
comparison mercurial/bundle2.py @ 33737:373ca5103ba8
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
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 24 Jul 2017 11:16:32 -0400 |
parents | db3dc11356ed |
children | 119e1c6be1ce |
comparison
equal
deleted
inserted
replaced
33736:2e43c5cd57a7 | 33737:373ca5103ba8 |
---|---|
998 #### header | 998 #### header |
999 if self.mandatory: | 999 if self.mandatory: |
1000 parttype = self.type.upper() | 1000 parttype = self.type.upper() |
1001 else: | 1001 else: |
1002 parttype = self.type.lower() | 1002 parttype = self.type.lower() |
1003 outdebug(ui, 'part %s: "%s"' % (self.id, parttype)) | 1003 outdebug(ui, 'part %s: "%s"' % (pycompat.bytestr(self.id), parttype)) |
1004 ## parttype | 1004 ## parttype |
1005 header = [_pack(_fparttypesize, len(parttype)), | 1005 header = [_pack(_fparttypesize, len(parttype)), |
1006 parttype, _pack(_fpartid, self.id), | 1006 parttype, _pack(_fpartid, self.id), |
1007 ] | 1007 ] |
1008 ## parameters | 1008 ## parameters |
1237 """read the header and setup the object""" | 1237 """read the header and setup the object""" |
1238 typesize = self._unpackheader(_fparttypesize)[0] | 1238 typesize = self._unpackheader(_fparttypesize)[0] |
1239 self.type = self._fromheader(typesize) | 1239 self.type = self._fromheader(typesize) |
1240 indebug(self.ui, 'part type: "%s"' % self.type) | 1240 indebug(self.ui, 'part type: "%s"' % self.type) |
1241 self.id = self._unpackheader(_fpartid)[0] | 1241 self.id = self._unpackheader(_fpartid)[0] |
1242 indebug(self.ui, 'part id: "%s"' % self.id) | 1242 indebug(self.ui, 'part id: "%s"' % pycompat.bytestr(self.id)) |
1243 # extract mandatory bit from type | 1243 # extract mandatory bit from type |
1244 self.mandatory = (self.type != self.type.lower()) | 1244 self.mandatory = (self.type != self.type.lower()) |
1245 self.type = self.type.lower() | 1245 self.type = self.type.lower() |
1246 ## reading parameters | 1246 ## reading parameters |
1247 # param count | 1247 # param count |