Patchwork [07,of,10,RFC] templatekw: simple example of labelify for {user}

login
register
mail settings
Submitter Sean Farley
Date Dec. 21, 2012, 5:37 a.m.
Message ID <a4f4ae7e3e20324f7066.1356068277@laptop.local>
Download mbox | patch
Permalink /patch/241/
State Superseded
Headers show

Comments

Sean Farley - Dec. 21, 2012, 5:37 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1356043845 21600
# Node ID a4f4ae7e3e20324f706677d898aac343734ce3a3
# Parent  add1ef9a4ea71b3da34b17a0d85307ce80ced92f
templatekw: simple example of labelify for {user}

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -4,10 +4,11 @@ 
 #
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
 from node import hex
+from templatefilters import labelify, delabelify
 import patch, util, error
 import hbisect
 
 # This helper class allows us to handle both:
 #  "{files}" (legacy command-line-specific list hack) and
@@ -162,11 +163,11 @@ 
     return getrenamed
 
 
 def showauthor(repo, ctx, templ, **args):
     """:author: String. The unmodified author of the changeset."""
-    return ctx.user()
+    return labelify(ctx.user(), 'log.user')
 
 def showbisect(repo, ctx, templ, **args):
     """:bisect: String. The changeset bisection status."""
     return hbisect.label(repo, ctx.node())