changeset 12371:48a4acd1ccf1

templater: add hex filter.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Wed, 22 Sep 2010 00:14:57 +0200
parents f98010f57a5e
children 5163e3c8aa52
files mercurial/help/templates.txt mercurial/templatefilters.py
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/help/templates.txt	Tue Sep 21 18:40:33 2010 +0200
+++ b/mercurial/help/templates.txt	Wed Sep 22 00:14:57 2010 +0200
@@ -106,6 +106,9 @@
 :escape: Any text. Replaces the special XML/XHTML characters "&", "<"
     and ">" with XML entities.
 
+:hex: Any text. Convert a binary Mercurial node identifier into
+    its long hexadecimal representation.
+
 :fill68: Any text. Wraps the text to fit in 68 columns.
 
 :fill76: Any text. Wraps the text to fit in 76 columns.
--- a/mercurial/templatefilters.py	Tue Sep 21 18:40:33 2010 +0200
+++ b/mercurial/templatefilters.py	Wed Sep 22 00:14:57 2010 +0200
@@ -6,7 +6,7 @@
 # GNU General Public License version 2 or any later version.
 
 import cgi, re, os, time, urllib
-import util, encoding
+import encoding, node, util
 
 def stringify(thing):
     '''turn nested template iterator into string.'''
@@ -216,6 +216,7 @@
     "person": person,
     "rfc822date": lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S %1%2"),
     "rfc3339date": lambda x: util.datestr(x, "%Y-%m-%dT%H:%M:%S%1:%2"),
+    "hex": node.hex,
     "short": lambda x: x[:12],
     "shortdate": util.shortdate,
     "stringify": stringify,