# HG changeset patch # User Mads Kiilerich # Date 2015-03-19 21:22:50 # Node ID e25ce44f8447169bc56f5cbd49a3522b7a3ad3ee # Parent d71db0e3b7b9067790a80c5f98d93f209eaa3ea6 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. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -709,7 +709,10 @@ class basefilectx(object): 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))