D2616: py3: replace __str__ to __bytes__ in hgext/journal.py

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sat Mar 3 18:23:39 EST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG148f64bcb6de: py3: replace __str__ to __bytes__ in hgext/journal.py (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2616?vs=6500&id=6504

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

AFFECTED FILES
  hgext/journal.py

CHANGE DETAILS

diff --git a/hgext/journal.py b/hgext/journal.py
--- a/hgext/journal.py
+++ b/hgext/journal.py
@@ -24,6 +24,7 @@
     bookmarks,
     cmdutil,
     dispatch,
+    encoding,
     error,
     extensions,
     hg,
@@ -219,15 +220,17 @@
             (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])
         return '\n'.join((
             time, self.user, self.command, self.namespace, self.name,
             oldhashes, newhashes))
 
+    __str__ = encoding.strmethod(__bytes__)
+
 class journalstorage(object):
     """Storage for journal entries
 



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


More information about the Mercurial-devel mailing list