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

Sean Farley sean.michael.farley at gmail.com
Thu Dec 20 23:37:57 CST 2012


# 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}

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())
 


More information about the Mercurial-devel mailing list