Show More
@@ -16,16 +16,13 b' def _string_escape(text):' | |||||
16 | >>> s |
|
16 | >>> s | |
17 | 'ab\\ncd\\\\\\\\n\\x00ab\\rcd\\\\\\n' |
|
17 | 'ab\\ncd\\\\\\\\n\\x00ab\\rcd\\\\\\n' | |
18 | >>> res = _string_escape(s) |
|
18 | >>> res = _string_escape(s) | |
19 |
>>> s == |
|
19 | >>> s == res.decode('string_escape') | |
20 | True |
|
20 | True | |
21 | """ |
|
21 | """ | |
22 | # subset of the string_escape codec |
|
22 | # subset of the string_escape codec | |
23 | text = text.replace('\\', '\\\\').replace('\n', '\\n').replace('\r', '\\r') |
|
23 | text = text.replace('\\', '\\\\').replace('\n', '\\n').replace('\r', '\\r') | |
24 | return text.replace('\0', '\\0') |
|
24 | return text.replace('\0', '\\0') | |
25 |
|
25 | |||
26 | def _string_unescape(text): |
|
|||
27 | return text.decode('string_escape') |
|
|||
28 |
|
||||
29 | class appender: |
|
26 | class appender: | |
30 | '''the changelog index must be update last on disk, so we use this class |
|
27 | '''the changelog index must be update last on disk, so we use this class | |
31 | to delay writes to it''' |
|
28 | to delay writes to it''' | |
@@ -123,10 +120,9 b' class changelog(revlog):' | |||||
123 | def decode_extra(self, text): |
|
120 | def decode_extra(self, text): | |
124 | extra = {} |
|
121 | extra = {} | |
125 | for l in text.split('\0'): |
|
122 | for l in text.split('\0'): | |
126 |
if |
|
123 | if l: | |
127 | continue |
|
124 | k, v = text.decode('string_escape').split(':', 1) | |
128 | k, v = _string_unescape(l).split(':', 1) |
|
125 | extra[k] = v | |
129 | extra[k] = v |
|
|||
130 | return extra |
|
126 | return extra | |
131 |
|
127 | |||
132 | def encode_extra(self, d): |
|
128 | def encode_extra(self, d): |
General Comments 0
You need to be logged in to leave comments.
Login now