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

login
register
mail settings
Submitter phabricator
Date March 3, 2018, 11:23 p.m.
Message ID <46d50d39a8ec8736735a1bc72fcc4366@localhost.localdomain>
Download mbox | patch
Permalink /patch/28869/
State Not Applicable
Headers show

Comments

phabricator - March 3, 2018, 11:23 p.m.
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




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

Patch

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