about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAbdó Roig-Maranges <abdo.roig@gmail.com>2012-11-15 00:42:35 +0100
committerAbdo Roig-Maranges <abdo.roig@gmail.com>2013-02-12 12:08:44 +0100
commit014fd772df3fdd505a595babc9e29e1398980527 (patch)
treec17af8d060fd8125a375d04c805a5b447c5acc70
parentaa4d6a7073165294f1e251df7d6310d20d449e81 (diff)
downloadranger-014fd772df3fdd505a595babc9e29e1398980527.tar.gz
Displays version control data on the status bar
Data displayed: branch, repo status and summary of last commit.
-rw-r--r--ranger/gui/widgets/statusbar.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index a2ce3830..da21b098 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -183,6 +183,26 @@ class StatusBar(Widget):
             left.add(strftime(self.timeformat,
                     localtime(stat.st_mtime)), 'mtime')
 
+        if target.vcs:
+            if target.vcsbranch:
+                vcsinfo = '(%s: %s)' % (target.vcs.vcsname, target.vcsbranch)
+            else:
+                vcsinfo = '(%s)' % (target.vcs.vcsname)
+
+            left.add_space()
+            left.add(vcsinfo, 'vcsinfo')
+
+            if target.vcsfilestatus:
+                left.add_space()
+                vcsstr, vcscol = self.vcsfilestatus_symb[target.vcsfilestatus]
+                left.add(vcsstr.strip(), 'vcsfile', *vcscol)
+            if target.vcsremotestatus:
+                vcsstr, vcscol = self.vcsremotestatus_symb[target.vcsremotestatus]
+                left.add(vcsstr.strip(), 'vcsremote', *vcscol)
+            if target.vcshead:
+                left.add_space()
+                left.add('%s' % target.vcshead['summary'], 'vcscommit')
+
     def _get_owner(self, target):
         uid = target.stat.st_uid
 
@@ -207,6 +227,8 @@ class StatusBar(Widget):
             except KeyError:
                 return str(gid)
 
+
+
     def _get_right_part(self, bar):
         right = bar.right
         if self.column is None:
@@ -263,7 +285,7 @@ class StatusBar(Widget):
                 right.add('{0:0>.0f}%'.format(100.0 * pos / max_pos),
                         base, 'percentage')
         else:
-            right.add('0/0  All', base, 'all')
+            right.add('0/0    All', base, 'all')
 
     def _print_result(self, result):
         self.win.move(0, 0)