# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 2013-08-02 23:24:08
# Node ID a45cf68dd9a254af14268e188e96b38c13a580da
# Parent  5af7045b0b18dea96d5eed2326c0ad2ded23b4f3

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.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -41,6 +41,9 @@ class basectx(object):
     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 @@ class changectx(basectx):
         raise error.RepoLookupError(
             _("unknown revision '%s'") % changeid)
 
-    def __repr__(self):
-        return "<changectx %s>" % str(self)
-
     def __hash__(self):
         try:
             return hash(self._rev)