# HG changeset patch
# User Yuki KODAMA <endflow....@gmail.com>
# Date 1252977182 -32400
# Node ID edf59eb928b6399a4750ab30ada81f78d3d255e5
# Parent  155cbb99f83f3ef3610723c86c8198af000e8a02
changeset: improve display of user/date line

diff --git a/tortoisehg/hgtk/changeset.py b/tortoisehg/hgtk/changeset.py
--- a/tortoisehg/hgtk/changeset.py
+++ b/tortoisehg/hgtk/changeset.py
@@ -286,26 +286,36 @@
             data = patch.extract(self.ui, pf)
             tmp, msg, user, date, branch, node, p1, p2 = data
             try:
-                ud = toutf(user)
-                if date:
-                    ud += '\t' + displaytime(util.parsedate(date))
-                msg = toutf(msg.rstrip('\r\n'))
-                patchname = os.path.basename(self.curpatch)
-                patchtitle = patchname
+                # title
+                patchtitle = os.path.basename(self.curpatch)
                 if node:
                     patchtitle += ' (%s)' % node[:12]
                 title_line(_('patch:'), patchtitle, 'changeset')
+                # branch
                 if branch:
                     title_line(_('branch:'), toutf(branch), 'greybg')
-                title_line(_('user/date:'), ud, 'changeset')
+                # user/date
+                udhead = udbody = None
+                if user and date:
+                    udhead = _('user/date:')
+                    udbody = toutf(user) + '\t' \
+                             + displaytime(util.parsedate(date))
+                elif user:
+                    udhead = _('user:')
+                    udbody = toutf(user)
+                elif date:
+                    udhead = _('date:')
+                    udbody = displaytime(util.parsedate(date))
+                if udhead and udbody:
+                    title_line(udhead, udbody, 'changeset')
+                # parents
                 for pnode in (p1, p2):
                     if pnode is None:
                         continue
-                    title = _('parent:')
-                    title += ' ' * (12 - len(title)) + pnode[:12]
-                    buf.insert_with_tags_by_name(eob, title, 'parent')
-                    buf.insert(eob, '\n')
-                buf.insert(eob, '\n' + msg + '\n\n')
+                    title_line(_('parent:'), pnode[:12])
+                # commit message
+                if msg:
+                    buf.insert(eob, '\n' + toutf(msg.rstrip('\r\n')) + '\n\n')
             finally:
                 if tmp:
                     os.unlink(tmp)

Attachment: thg-kuy_rev4014.patch
Description: Binary data

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; 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&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to