Patchwork [04,of,35,V2] context: move __str__ from changectx

login
register
mail settings
Submitter Sean Farley
Date Aug. 7, 2013, 11:51 p.m.
Message ID <7de79f2d442e3e404a8b.1375919478@laptop.local>
Download mbox | patch
Permalink /patch/2057/
State Accepted
Headers show

Comments

Sean Farley - Aug. 7, 2013, 11:51 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1375479983 18000
#      Fri Aug 02 16:46:23 2013 -0500
# Node ID 7de79f2d442e3e404a8b363ef7ecdf2049078b56
# Parent  93e23839fcc5b6c0eb22592f27b5abbe2c4c1321
context: move __str__ from changectx

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -33,10 +33,13 @@ 
         o._rev = nullrev
         o._node = nullid
 
         return o
 
+    def __str__(self):
+        return short(self.node())
+
 class changectx(context):
     """A changecontext object makes access to data related to a particular
     changeset convenient. It represents a read-only context already presnt in
     the repo."""
     def __init__(self, repo, changeid=''):
@@ -138,13 +141,10 @@ 
         except TypeError:
             pass
         raise error.RepoLookupError(
             _("unknown revision '%s'") % changeid)
 
-    def __str__(self):
-        return short(self.node())
-
     def __int__(self):
         return self.rev()
 
     def __repr__(self):
         return "<changectx %s>" % str(self)