Add str methods to contexts
authorMatt Mackall <mpm@selenic.com>
Fri, 29 Sep 2006 16:29:44 -0500
changeset 3166 ebdb3f616bc0
parent 3165 e78185746554
child 3167 e67c22bc8bba
Add str methods to contexts
mercurial/context.py
--- a/mercurial/context.py	Fri Sep 29 16:01:46 2006 -0500
+++ b/mercurial/context.py	Fri Sep 29 16:29:44 2006 -0500
@@ -28,6 +28,9 @@
         self._node = self._repo.lookup(changeid)
         self._rev = self._repo.changelog.rev(self._node)
 
+    def __str__(self):
+        return short(self.node())
+
     def __repr__(self):
         return "<changectx %s>" % short(self.node())
 
@@ -126,6 +129,9 @@
         else:
             raise AttributeError, name
 
+    def __str__(self):
+        return "%s@%s" % (self.path(), short(self.node()))
+
     def __repr__(self):
         return "<filectx %s@%s>" % (self.path(), short(self.node()))