changeset 19546:a45cf68dd9a2

basectx: move __repr__ from changectx We change the hardcoded 'changectx' to instead use type(self).__name__ so that objects that inherit from basectx in the future will be able to use the same representation.
author Sean Farley <sean.michael.farley@gmail.com>
date Fri, 02 Aug 2013 18:24:08 -0500
parents 5af7045b0b18
children 0537c0cfd87c
files mercurial/context.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Fri Aug 02 16:52:13 2013 -0500
+++ b/mercurial/context.py	Fri Aug 02 18:24:08 2013 -0500
@@ -41,6 +41,9 @@
     def __int__(self):
         return self.rev()
 
+    def __repr__(self):
+        return "<%s %s>" % (type(self).__name__, str(self))
+
     def rev(self):
         return self._rev
     def node(self):
@@ -153,9 +156,6 @@
         raise error.RepoLookupError(
             _("unknown revision '%s'") % changeid)
 
-    def __repr__(self):
-        return "<changectx %s>" % str(self)
-
     def __hash__(self):
         try:
             return hash(self._rev)