changeset 22702:08a4e70ed183

branches: format rev as integer that is necessary for generic templater
author Yuya Nishihara <yuya@tcha.org>
date Thu, 02 Oct 2014 22:15:39 +0900
parents cb28d2b3db0b
children bd6e95cb82b4
files mercurial/commands.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Oct 03 22:20:02 2014 +0900
+++ b/mercurial/commands.py	Thu Oct 02 22:15:39 2014 +0900
@@ -1116,8 +1116,10 @@
             notice = _(' (inactive)')
         if tag == repo.dirstate.branch():
             label = 'branches.current'
-        rev = str(ctx.rev()).rjust(31 - encoding.colwidth(tag))
-        rev = ui.label('%s:%s' % (rev, hexfunc(ctx.node())),
+        rev = ctx.rev()
+        padsize = max(31 - len(str(rev)) - encoding.colwidth(tag), 0)
+        fmt = ' ' * padsize + '%d:%s'
+        rev = ui.label(fmt % (rev, hexfunc(ctx.node())),
                        'log.changeset changeset.%s' % ctx.phasestr())
         labeledtag = ui.label(tag, label)
         if ui.quiet: