Merge pull request #1013 from ZyX-I/fix-341

Catch errors from tree_status
This commit is contained in:
Nikolai Aleksandrovich Pavlov 2014-08-24 18:02:50 +04:00
commit e7ef2d14d3
2 changed files with 6 additions and 2 deletions

View File

@ -196,7 +196,7 @@ class TreeStatusCache(dict):
if self.tw(key, ignore_event=getattr(repo, 'ignore_event', None)):
self.pop(key, None)
except OSError as e:
self.pl.warn('Failed to check %s for changes, with error: %s' % key, e)
self.pl.warn('Failed to check {0} for changes, with error: {1}', key, str(e))
return self.cache_and_get(key, repo.status)

View File

@ -69,7 +69,11 @@ def branch(pl, segment_info, create_watcher, status_colors=False):
branch = repo.branch()
scol = ['branch']
if status_colors:
status = tree_status(repo, pl)
try:
status = tree_status(repo, pl)
except Exception as e:
pl.exception('Failed to compute tree status: {0}', str(e))
status = '?'
scol.insert(0, 'branch_dirty' if status and status.strip() else 'branch_clean')
return [{
'contents': branch,