changeset 3151:6719b3dd7d50

context: add __repr__ methods
author Matt Mackall <mpm@selenic.com>
date Fri, 22 Sep 2006 16:12:39 -0500
parents a5e4c8172ace
children 15d585dcdd1c d01e4cb2f5f2
files mercurial/context.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Fri Sep 22 16:01:14 2006 -0500
+++ b/mercurial/context.py	Fri Sep 22 16:12:39 2006 -0500
@@ -28,6 +28,9 @@
         self._node = self._repo.lookup(changeid)
         self._rev = self._repo.changelog.rev(self._node)
 
+    def __repr__(self):
+        return "<changectx %s>" % short(self.node())
+
     def changeset(self):
         try:
             return self._changeset
@@ -120,6 +123,9 @@
         else:
             raise AttributeError, name
 
+    def __repr__(self):
+        return "<filectx %s:%s>" % (self.path(), short(self.node()))
+
     def filerev(self): return self._filerev
     def filenode(self): return self._filenode
     def filelog(self): return self._filelog