comparison mercurial/bundle2.py @ 44256:74172a234dd3 stable

py3: fully fix bundlepart.__repr__ to return str not bytes My previous fix did not fully fix the issue: it would attempt to use %-formatting to combine two strs into a bytes, which won't work. Let's just switch the entire function to operating in strs. This can cause a small output difference that will likely not be noticed since no one noticed that the method wasn't working at all before: if `id` or `type` are not-None, they'll be shown as `b'val'` instead of `val`. Since this is a debugging aid and these strings shouldn't be shown to the user, slightly rough output is most likely fine and it's likely not worthwhile to add the necessary conditionals to marginally improve it. Differential Revision: https://phab.mercurial-scm.org/D8091
author Kyle Lippincott <spectral@google.com>
date Thu, 06 Feb 2020 15:46:55 -0800
parents c443b9ba6f63
children 8407031f195f
comparison
equal deleted inserted replaced
44255:541a509a47a8 44256:74172a234dd3
1011 # - False: currently generated, 1011 # - False: currently generated,
1012 # - True: generation done. 1012 # - True: generation done.
1013 self._generated = None 1013 self._generated = None
1014 self.mandatory = mandatory 1014 self.mandatory = mandatory
1015 1015
1016 @encoding.strmethod
1017 def __repr__(self): 1016 def __repr__(self):
1018 cls = b"%s.%s" % (self.__class__.__module__, self.__class__.__name__) 1017 cls = "%s.%s" % (self.__class__.__module__, self.__class__.__name__)
1019 return b'<%s object at %x; id: %s; type: %s; mandatory: %s>' % ( 1018 return '<%s object at %x; id: %s; type: %s; mandatory: %s>' % (
1020 cls, 1019 cls,
1021 id(self), 1020 id(self),
1022 self.id, 1021 self.id,
1023 self.type, 1022 self.type,
1024 self.mandatory, 1023 self.mandatory,