Patchwork D2042: py3: add __bytes__() for mq.patchheader and make sure __str__ returns str

login
register
mail settings
Submitter phabricator
Date Feb. 5, 2018, 2:27 p.m.
Message ID <def1ffae8c473cd3de22d26d5382e005@localhost.localdomain>
Download mbox | patch
Permalink /patch/27322/
State Not Applicable
Headers show

Comments

phabricator - Feb. 5, 2018, 2:27 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd41e41d11574: py3: add __bytes__() for mq.patchheader and make sure __str__ returns str (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2042?vs=5200&id=5213

REVISION DETAIL
  https://phab.mercurial-scm.org/D2042

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS




To: pulkit, #hg-reviewers, yuja
Cc: mercurial-devel

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -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