diff mercurial/context.py @ 3199:ebdb3f616bc0

Add str methods to contexts
author Matt Mackall <mpm@selenic.com>
date Fri, 29 Sep 2006 16:29:44 -0500
parents e78185746554
children 05c588e1803d
line wrap: on
line diff
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -28,6 +28,9 @@ class changectx(object):
         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 @@ class filectx(object):
         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()))