branches: format rev as integer that is necessary for generic templater
authorYuya Nishihara <yuya@tcha.org>
Thu, 02 Oct 2014 22:15:39 +0900
changeset 22702 08a4e70ed183
parent 22701 cb28d2b3db0b
child 22703 bd6e95cb82b4
branches: format rev as integer that is necessary for generic templater
mercurial/commands.py
--- 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: