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.
--- 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))