# HG changeset patch # User Matt Mackall # Date 1198821340 21600 # Node ID 234e40e636a8d5021b93d02ef88fe161045966e6 # Parent 9db7fd77417de13b6173097acbcdd50ae7c4f8fb changelog: inline trivial call for extra data unescaping diff -r 9db7fd77417d -r 234e40e636a8 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):