D8091: py3: fully fix bundlepart.__repr__ to return str not bytes
Closed by commit rHG74172a234dd3: py3: fully fix bundlepart.__repr__ to return str not bytes (authored by spectral). This revision was automatically updated to reflect the committed changes. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D8091?vs=19978=19994 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8091/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8091 AFFECTED FILES mercurial/bundle2.py CHANGE DETAILS diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -1013,10 +1013,9 @@ self._generated = None self.mandatory = mandatory -@encoding.strmethod def __repr__(self): -cls = b"%s.%s" % (self.__class__.__module__, self.__class__.__name__) -return b'<%s object at %x; id: %s; type: %s; mandatory: %s>' % ( +cls = "%s.%s" % (self.__class__.__module__, self.__class__.__name__) +return '<%s object at %x; id: %s; type: %s; mandatory: %s>' % ( cls, id(self), self.id, To: spectral, #hg-reviewers, marmoute, pulkit Cc: marmoute, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D8091: py3: fully fix bundlepart.__repr__ to return str not bytes
marmoute added a comment. marmoute accepted this revision. I guess we could build the string, and then turn it into a bytes. That seems simple enough to be worth doing. Howevr you are fixing a bug here and as you poitned out, this `__repr__` is not really important. So you get a stamp. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8091/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8091 To: spectral, #hg-reviewers, marmoute Cc: marmoute, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D8091: py3: fully fix bundlepart.__repr__ to return str not bytes
spectral created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 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. REPOSITORY rHG Mercurial BRANCH stable REVISION DETAIL https://phab.mercurial-scm.org/D8091 AFFECTED FILES mercurial/bundle2.py CHANGE DETAILS diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -1013,10 +1013,9 @@ self._generated = None self.mandatory = mandatory -@encoding.strmethod def __repr__(self): -cls = b"%s.%s" % (self.__class__.__module__, self.__class__.__name__) -return b'<%s object at %x; id: %s; type: %s; mandatory: %s>' % ( +cls = "%s.%s" % (self.__class__.__module__, self.__class__.__name__) +return '<%s object at %x; id: %s; type: %s; mandatory: %s>' % ( cls, id(self), self.id, To: spectral, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel