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

Sean Farley sean.michael.farley at gmail.com
Wed Aug 7 18:51:18 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 7de79f2d442e3e404a8b363ef7ecdf2049078b56
# Parent  93e23839fcc5b6c0eb22592f27b5abbe2c4c1321
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=''):
@@ -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)


More information about the Mercurial-devel mailing list