Mercurial > public > mercurial-scm > hg-stable
diff mercurial/context.py @ 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 | 3e3f2201bbdf |
children | e81d72b4b0ae |
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))