mq: fix up statusentry to be both repr()-able and bytes()-able
authorAugie Fackler <augie@google.com>
Wed, 17 Jan 2018 22:04:34 -0500
changeset 41825 9bce28609a95fdc8c363f7e217169fada042d63a
parent 41824 7df43e0b9fc3349a68dd2df037af3cdf9dd33637
child 41826 512113eb9d264674b593ad037496b5009a49c3d3
push id662
push usergszorc@mozilla.com
push dateFri, 02 Feb 2018 00:19:02 +0000
mq: fix up statusentry to be both repr()-able and bytes()-able Differential Revision: https://phab.mercurial-scm.org/D1901
hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -143,19 +143,23 @@ checklocalchanges = stripext.checklocalc
 
 # Patch names looks like unix-file names.
 # They must be joinable with queue directory and result in the patch path.
 normname = util.normpath
 
 class statusentry(object):
     def __init__(self, node, name):
         self.node, self.name = node, name
-    def __repr__(self):
+
+    def __bytes__(self):
         return hex(self.node) + ':' + self.name
 
+    __str__ = encoding.strmethod(__bytes__)
+    __repr__ = encoding.strmethod(__bytes__)
+
 # The order of the headers in 'hg export' HG patches:
 HGHEADERS = [
 #   '# HG changeset patch',
     '# User ',
     '# Date ',
     '#      ',
     '# Branch ',
     '# Node ID ',