Mercurial > hg-stable
changeset 5745:234e40e636a8
changelog: inline trivial call for extra data unescaping
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 27 Dec 2007 23:55:40 -0600 |
parents | 9db7fd77417d |
children | d3ef7e86bc3b |
files | mercurial/changelog.py |
diffstat | 1 files changed, 4 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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):