Mercurial > hg
changeset 35916:d41e41d11574
py3: add __bytes__() for mq.patchheader and make sure __str__ returns str
Before this patch, __str__() function for mq.patchheader class return bytes
which is not str on Python 3. So let's move that logic to __bytes__() and for
__str__() convert the return value of __bytes__() to str.
Differential Revision: https://phab.mercurial-scm.org/D2042
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 05 Feb 2018 13:10:33 +0530 |
parents | 83b9f96ce20f |
children | 3d8b0020f470 |
files | hgext/mq.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Mon Feb 05 13:01:35 2018 +0530 +++ b/hgext/mq.py Mon Feb 05 13:10:33 2018 +0530 @@ -396,12 +396,14 @@ self.comments.append('') self.comments.append(message) - def __str__(self): + def __bytes__(self): s = '\n'.join(self.comments).rstrip() if not s: return '' return s + '\n\n' + __str__ = encoding.strmethod(__bytes__) + def _delmsg(self): '''Remove existing message, keeping the rest of the comments fields. If comments contains 'subject: ', message will prepend