changeset 36695:d79d68bb9f7c

py3: replace __str__ to __bytes__ in hgext/journal.py Differential Revision: https://phab.mercurial-scm.org/D2616
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 02 Mar 2018 07:15:54 +0530
parents 6276cbc704a6
children bcfc4e3b6548
files hgext/journal.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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