changeset 3166:ebdb3f616bc0

Add str methods to contexts
author Matt Mackall <mpm@selenic.com>
date Fri, 29 Sep 2006 16:29:44 -0500
parents e78185746554
children e67c22bc8bba
files mercurial/context.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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()))