[PATCH 04 of 10 RFC] templatefilter: make stringify remove label wrappers

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


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1355961574 21600
# Node ID 5c79792796ac3141f0501d8e20d97b26dd8f5f4f
# Parent  19bea005cd095a81941820efcf5b924cc354d293
templatefilter: make stringify remove label wrappers

The first order of business is to make sure stringify returns only a string.

diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
--- a/mercurial/templatefilters.py
+++ b/mercurial/templatefilters.py
@@ -303,10 +303,11 @@
 
 def stringify(thing):
     """:stringify: Any type. Turns the value into text by converting values into
     text and concatenating them.
     """
+    thing, label = delabelify(thing)
     if util.safehasattr(thing, '__iter__') and not isinstance(thing, str):
         return "".join([stringify(t) for t in thing if t is not None])
     return str(thing)
 
 def strip(text):


More information about the Mercurial-devel mailing list