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.
( )
| quark |
| hg-reviewers |
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.
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/bundle2.py (4 lines) |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | durin42 | ||
| Closed | durin42 | ||
| Abandoned | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 |
| msg.append('\n') | msg.append('\n') | ||||
| ui.debug(''.join(msg)) | ui.debug(''.join(msg)) | ||||
| #### header | #### header | ||||
| if self.mandatory: | if self.mandatory: | ||||
| parttype = self.type.upper() | parttype = self.type.upper() | ||||
| else: | else: | ||||
| parttype = self.type.lower() | parttype = self.type.lower() | ||||
| outdebug(ui, 'part %s: "%s"' % (self.id, parttype)) | outdebug(ui, 'part %s: "%s"' % (pycompat.bytestr(self.id), parttype)) | ||||
| ## parttype | ## parttype | ||||
| header = [_pack(_fparttypesize, len(parttype)), | header = [_pack(_fparttypesize, len(parttype)), | ||||
| parttype, _pack(_fpartid, self.id), | parttype, _pack(_fpartid, self.id), | ||||
| ] | ] | ||||
| ## parameters | ## parameters | ||||
| # count | # count | ||||
| manpar = self.mandatoryparams | manpar = self.mandatoryparams | ||||
| advpar = self.advisoryparams | advpar = self.advisoryparams | ||||
| raise ValueError('Unknown chunk') | raise ValueError('Unknown chunk') | ||||
| def _readheader(self): | def _readheader(self): | ||||
| """read the header and setup the object""" | """read the header and setup the object""" | ||||
| typesize = self._unpackheader(_fparttypesize)[0] | typesize = self._unpackheader(_fparttypesize)[0] | ||||
| self.type = self._fromheader(typesize) | self.type = self._fromheader(typesize) | ||||
| indebug(self.ui, 'part type: "%s"' % self.type) | indebug(self.ui, 'part type: "%s"' % self.type) | ||||
| self.id = self._unpackheader(_fpartid)[0] | 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 | # extract mandatory bit from type | ||||
| self.mandatory = (self.type != self.type.lower()) | self.mandatory = (self.type != self.type.lower()) | ||||
| self.type = self.type.lower() | self.type = self.type.lower() | ||||
| ## reading parameters | ## reading parameters | ||||
| # param count | # param count | ||||
| mancount, advcount = self._unpackheader(_fpartparamcount) | mancount, advcount = self._unpackheader(_fpartparamcount) | ||||
| indebug(self.ui, 'part parameters: %i' % (mancount + advcount)) | indebug(self.ui, 'part parameters: %i' % (mancount + advcount)) | ||||
| # param size | # param size | ||||