changelog: inline trivial call for extra data unescaping
authorMatt Mackall <mpm@selenic.com>
Thu, 27 Dec 2007 23:55:40 -0600
changeset 5745 234e40e636a8
parent 5744 9db7fd77417d
child 5746 d3ef7e86bc3b
changelog: inline trivial call for extra data unescaping
mercurial/changelog.py
--- a/mercurial/changelog.py	Thu Dec 27 23:55:40 2007 -0600
+++ b/mercurial/changelog.py	Thu Dec 27 23:55:40 2007 -0600
@@ -16,16 +16,13 @@
     >>> s
     'ab\\ncd\\\\\\\\n\\x00ab\\rcd\\\\\\n'
     >>> res = _string_escape(s)
-    >>> s == _string_unescape(res)
+    >>> s == res.decode('string_escape')
     True
     """
     # subset of the string_escape codec
     text = text.replace('\\', '\\\\').replace('\n', '\\n').replace('\r', '\\r')
     return text.replace('\0', '\\0')
 
-def _string_unescape(text):
-    return text.decode('string_escape')
-
 class appender:
     '''the changelog index must be update last on disk, so we use this class
     to delay writes to it'''
@@ -123,10 +120,9 @@
     def decode_extra(self, text):
         extra = {}
         for l in text.split('\0'):
-            if not l:
-                continue
-            k, v = _string_unescape(l).split(':', 1)
-            extra[k] = v
+            if l:
+                k, v = text.decode('string_escape').split(':', 1)
+                extra[k] = v
         return extra
 
     def encode_extra(self, d):