Commits

Peter Arrenbrecht committed 6120570

history: add column showing Subversion rev

Comments (0)

Files changed (3)

tortoisehg/hgtk/history.py

         column('utc', _('UTC Date'))
         column('age', _('Age'))
         column('tag', _('Tags'))
+        column('svn', _('Subversion'))
 
         model = gtk.ListStore(
             gobject.TYPE_BOOLEAN,

tortoisehg/hgtk/logview/treemodel.py

 FGCOLOR = 13
 AGE = 14
 CHANGES = 15
+SVNREV = 16
 
 class TreeModel(gtk.GenericTreeModel):
 
         if index == FGCOLOR: return str
         if index == AGE: return str
         if index == CHANGES: return str
+        if index == SVNREV: return str
 
     def on_get_iter(self, path):
         return path[0]
             tags = self.repo.nodetags(ctx.node())
             cache[TAGS] = hglib.toutf(', '.join(tags))
 
+        elif column == SVNREV:
+            extra = ctx.extra()
+            cvt = extra.get('convert_revision', '')
+            if cvt.startswith('svn:'):
+                rev = cvt.split('/', 1)[-1]
+                rev = rev.split('@', 1)[-1]
+            else:
+                rev = None
+            cache[SVNREV] = rev and hglib.toutf('r%s' % rev) or ''
+
         elif column == AGE:
             cache[AGE] = hglib.age(ctx.date())
 

tortoisehg/hgtk/logview/treeview.py

 from tortoisehg.hgtk.logview.graphcell import CellRendererGraph
 from tortoisehg.hgtk.logview.revgraph import *
 
-COLS = 'graph rev id revhex branch changes msg user date utc age tag'
+COLS = 'graph rev id revhex branch changes msg user date utc age tag svn'
 
 class TreeView(gtk.ScrolledWindow):
 
                                  'Show tag column',
                                  False,
                                  gobject.PARAM_READWRITE),
+        'svn-column-visible': (gobject.TYPE_BOOLEAN,
+                                 'Subversion',
+                                 'Show Subversion column',
+                                 False,
+                                 gobject.PARAM_READWRITE),
         'branch-color': (gobject.TYPE_BOOLEAN,
                                  'Branch color',
                                  'Color by branch',
         col.add_attribute(cell, "text", treemodel.TAGS)
         col.add_attribute(cell, "foreground", treemodel.FGCOLOR)
 
+        cell = gtk.CellRendererText()
+        cell.set_property("width-chars", 10)
+        cell.set_property("ellipsize", pango.ELLIPSIZE_END)
+        col = self.tvcolumns['svn']  = gtk.TreeViewColumn(_('Subversion'))
+        col.set_visible(False)
+        col.set_resizable(True)
+        col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
+        col.set_fixed_width(cell.get_size(self.treeview)[2])
+        col.pack_start(cell, expand=True)
+        col.add_attribute(cell, "text", treemodel.SVNREV)
+        col.add_attribute(cell, "foreground", treemodel.FGCOLOR)
+
         self.columns = COLS.split()
 
     def set_columns(self, columns):