py3: replace __str__ to __bytes__ in hgext/journal.py
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 02 Mar 2018 07:15:54 +0530
changeset 36666 d79d68bb9f7c
parent 36665 6276cbc704a6
child 36667 bcfc4e3b6548
py3: replace __str__ to __bytes__ in hgext/journal.py Differential Revision: https://phab.mercurial-scm.org/D2616
hgext/journal.py
--- a/hgext/journal.py	Wed Jan 31 22:21:33 2018 -0800
+++ b/hgext/journal.py	Fri Mar 02 07:15:54 2018 +0530
@@ -24,6 +24,7 @@
     bookmarks,
     cmdutil,
     dispatch,
+    encoding,
     error,
     extensions,
     hg,
@@ -219,8 +220,8 @@
             (timestamp, tz), user, command, namespace, name,
             oldhashes, newhashes)
 
-    def __str__(self):
-        """String representation for storage"""
+    def __bytes__(self):
+        """bytes representation for storage"""
         time = ' '.join(map(str, self.timestamp))
         oldhashes = ','.join([node.hex(hash) for hash in self.oldhashes])
         newhashes = ','.join([node.hex(hash) for hash in self.newhashes])
@@ -228,6 +229,8 @@
             time, self.user, self.command, self.namespace, self.name,
             oldhashes, newhashes))
 
+    __str__ = encoding.strmethod(__bytes__)
+
 class journalstorage(object):
     """Storage for journal entries