diff --git a/powerline/lib/vcs/__init__.py b/powerline/lib/vcs/__init__.py index ea11b345..ba00eca2 100644 --- a/powerline/lib/vcs/__init__.py +++ b/powerline/lib/vcs/__init__.py @@ -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) diff --git a/powerline/segments/common.py b/powerline/segments/common.py index ecb77700..8aefb16b 100644 --- a/powerline/segments/common.py +++ b/powerline/segments/common.py @@ -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,