[PATCH 03 of 36] context: move __str__ from changectx

Sean Farley sean.michael.farley at gmail.com
Wed Aug 7 13:13:03 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1375479983 18000
#      Fri Aug 02 16:46:23 2013 -0500
# Node ID 8fc7a11d2a2f02bd6491fa9c24656d0e44a0a92d
# Parent  8e7a1ca270327a1e3e42e421d7bb897b84d752b7
context: move __str__ from changectx

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=''):
@@ -132,13 +135,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)


More information about the Mercurial-devel mailing list