# HG changeset patch
# User Henrik Stuart <henrik.stu...@edlund.dk>
# Date 1256558612 -3600
# Branch stable
# Node ID 11ffb22fc57409a8c2a9135f80a4bf42ee03380c
# Parent  7309a8ee1daf9b75062b9840fa1b95fd69ad9811
changeset: show parent/child branch if they differ from current

This feature was forgotten when the changeset field was rewritten to the new
version.

diff --git a/tortoisehg/hgtk/changeset.py b/tortoisehg/hgtk/changeset.py
--- a/tortoisehg/hgtk/changeset.py
+++ b/tortoisehg/hgtk/changeset.py
@@ -438,11 +438,11 @@
             def summary_line(desc):
                 desc = desc.replace('\0', '')
                 return hglib.toutf(desc.split('\n')[0][:80])
-            def revline_data(ctx, hl=False):
+            def revline_data(ctx, hl=False, branch=None):
                 if isinstance(ctx, basestring):
                     return ctx
                 desc = ctx.description()
-                return (str(ctx.rev()), str(ctx), summary_line(desc), hl)
+                return (str(ctx.rev()), str(ctx), summary_line(desc), hl, 
branch)
             if item == 'cset':
                 return revline_data(ctx)
             elif item == 'branch':
@@ -454,10 +454,17 @@
                 parents = []
                 for pctx in pctxs:
                     highlight = len(pctxs) == 2 and pctx == pctxs[pindex]
-                    parents.append(revline_data(pctx, highlight))
+                    branch = pctx.branch() != ctx.branch() and pctx.branch() 
or None
+                    parents.append(revline_data(pctx, highlight, branch))
                 return parents
             elif item == 'children':
-                return [revline_data(ctx) for ctx in ctx.children()]
+                children = []
+                for cctx in ctx.children():
+                    branch = None
+                    if cctx.branch() != ctx.branch():
+                        branch = cctx.branch()
+                    children.append(revline_data(cctx, branch=branch))
+                return children
             elif item == 'transplant':
                 ts = widget.get_data('transplant', usepreset=True)
                 if not ts:
@@ -484,13 +491,17 @@
                 return _('Patch:')
             raise csinfo.UnknownItem(item)
         def markup_func(widget, item, value):
-            def revline_markup(revnum, revid, summary, highlight=None):
+            def revline_markup(revnum, revid, summary, highlight=None, 
branch=None):
                 revnum = gtklib.markup(revnum)
                 summary = gtklib.markup(summary)
                 if revid:
                     revid = revid_markup(revid)
+                    if branch:
+                        return '%s (%s) [%s] %s' % (revnum, revid, branch, 
summary)
                     return '%s (%s) %s' % (revnum, revid, summary)
                 else:
+                    if branch:
+                        return '%s [%s] - %s' % (revnum, branch, summary)
                     return '%s - %s' % (revnum, summary)
             if item in ('cset', 'transplant', 'patch'):
                 if isinstance(value, basestring):
@@ -506,12 +517,18 @@
                 return csets
             raise csinfo.UnknownItem(item)
         def widget_func(widget, item, markups):
-            def linkwidget(revnum, revid, summary, highlight=None):
+            def linkwidget(revnum, revid, summary, highlight=None, 
branch=None):
                 opts = dict(underline='single', foreground='#0000FF')
                 if highlight:
                     opts['weight'] = 'bold'
-                rev = '%s (%s)' % (gtklib.markup(revnum, **opts),
-                                   revid_markup(revid, **opts))
+                revfmt = '%s (%s)'
+                revargs = [gtklib.markup(revnum, **opts),
+                        revid_markup(revid, **opts)]
+                if branch:
+                    revfmt = '%s (%s) [%s]'
+                    revargs.append(branch)
+
+                rev = revfmt % tuple(revargs)
                 link = gtk.Label()
                 link.set_markup(rev)
                 link.set_selectable(True)

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to