Patchwork [3,of,3] templater: drop old jsonescape

login
register
mail settings
Submitter Matt Mackall
Date Jan. 12, 2016, 5:01 p.m.
Message ID <407dfc31b621bb55a942.1452618067@ruin.waste.org>
Download mbox | patch
Permalink /patch/12696/
State Changes Requested
Delegated to: Yuya Nishihara
Headers show

Comments

Matt Mackall - Jan. 12, 2016, 5:01 p.m.
# HG changeset patch
# User Matt Mackall <mpm@selenic.com>
# Date 1452542539 21600
#      Mon Jan 11 14:02:19 2016 -0600
# Node ID 407dfc31b621bb55a94269b2beda986998dbc763
# Parent  35d049d7e5a2dec87318ce8042844f56e107cf83
templater: drop old jsonescape

Patch

diff -r 35d049d7e5a2 -r 407dfc31b621 mercurial/templatefilters.py
--- a/mercurial/templatefilters.py	Mon Jan 11 14:00:32 2016 -0600
+++ b/mercurial/templatefilters.py	Mon Jan 11 14:02:19 2016 -0600
@@ -215,23 +215,6 @@ 
     else:
         raise TypeError('cannot encode type %s' % obj.__class__.__name__)
 
-def _uescape(c):
-    if 0x20 <= ord(c) < 0x80:
-        return c
-    else:
-        return '\\u%04x' % ord(c)
-
-_escapes = [
-    ('\\', '\\\\'), ('"', '\\"'), ('\t', '\\t'), ('\n', '\\n'),
-    ('\r', '\\r'), ('\f', '\\f'), ('\b', '\\b'),
-    ('<', '\\u003c'), ('>', '\\u003e'), ('\0', '\\u0000')
-]
-
-def jsonescape(s):
-    for k, v in _escapes:
-        s = s.replace(k, v)
-    return ''.join(_uescape(c) for c in s)
-
 def lower(text):
     """:lower: Any text. Converts the text to lowercase."""
     return encoding.lower(text)