Patchwork D1901: mq: fix up statusentry to be both repr()-able and bytes()-able

login
register
mail settings
Submitter phabricator
Date Jan. 18, 2018, 4:13 p.m.
Message ID <d1bfcdd2dfa7afcde6e1e2aaa233f1d3@localhost.localdomain>
Download mbox | patch
Permalink /patch/26913/
State Not Applicable
Headers show

Comments

phabricator - Jan. 18, 2018, 4:13 p.m.
durin42 updated this revision to Diff 4908.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1901?vs=4891&id=4908

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

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS




To: durin42, #hg-reviewers, pulkit
Cc: yuja, mercurial-devel

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -148,9 +148,13 @@ 
 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',