From 10665f4c7dfb37501f1dad6a0de9a5f2c2c6a2ea Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 24 Aug 2014 17:45:08 +0400 Subject: [PATCH 1/2] Do not format message before passing it to self.pl.warn --- powerline/lib/vcs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From 2d4897d5dd6ec6b7ad33304d327e344893f0e8a3 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 24 Aug 2014 17:46:11 +0400 Subject: [PATCH 2/2] Catch errors from tree_status Fixes #341 --- powerline/segments/common.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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,