changeset 30284:e25ce44f8447

context: make sure __str__ works, also when there is no _changectx Before, it could crash when trying to print the wrong kind of object at the wrong time.
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 19 Mar 2015 22:22:50 +0100
parents d71db0e3b7b9
children 0fa1a41d04e4
files mercurial/context.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Tue Oct 18 16:45:39 2016 +0200
+++ b/mercurial/context.py	Thu Mar 19 22:22:50 2015 +0100
@@ -709,7 +709,10 @@
             return False
 
     def __str__(self):
-        return "%s@%s" % (self.path(), self._changectx)
+        try:
+            return "%s@%s" % (self.path(), self._changectx)
+        except error.LookupError:
+            return "%s@???" % self.path()
 
     def __repr__(self):
         return "<%s %s>" % (type(self).__name__, str(self))