Show More
@@ -9,6 +9,8 b' from node import bin, hex, nullid' | |||||
9 | from i18n import _ |
|
9 | from i18n import _ | |
10 | import util, error, revlog, encoding |
|
10 | import util, error, revlog, encoding | |
11 |
|
11 | |||
|
12 | _defaultextra = {'branch': 'default'} | |||
|
13 | ||||
12 | def _string_escape(text): |
|
14 | def _string_escape(text): | |
13 | """ |
|
15 | """ | |
14 | >>> d = {'nl': chr(10), 'bs': chr(92), 'cr': chr(13), 'nul': chr(0)} |
|
16 | >>> d = {'nl': chr(10), 'bs': chr(92), 'cr': chr(13), 'nul': chr(0)} | |
@@ -26,11 +28,11 b' def _string_escape(text):' | |||||
26 | def decodeextra(text): |
|
28 | def decodeextra(text): | |
27 | """ |
|
29 | """ | |
28 | >>> decodeextra(encodeextra({'foo': 'bar', 'baz': chr(0) + '2'})) |
|
30 | >>> decodeextra(encodeextra({'foo': 'bar', 'baz': chr(0) + '2'})) | |
29 | {'foo': 'bar', 'baz': '\\x002'} |
|
31 | {'foo': 'bar', 'baz': '\\x002', 'branch': 'default'} | |
30 | >>> decodeextra(encodeextra({'foo': 'bar', 'baz': chr(92) + chr(0) + '2'})) |
|
32 | >>> decodeextra(encodeextra({'foo': 'bar', 'baz': chr(92) + chr(0) + '2'})) | |
31 | {'foo': 'bar', 'baz': '\\\\\\x002'} |
|
33 | {'foo': 'bar', 'baz': '\\\\\\x002', 'branch': 'default'} | |
32 | """ |
|
34 | """ | |
33 | extra = {} |
|
35 | extra = _defaultextra.copy() | |
34 | for l in text.split('\0'): |
|
36 | for l in text.split('\0'): | |
35 | if l: |
|
37 | if l: | |
36 | if '\\0' in l: |
|
38 | if '\\0' in l: | |
@@ -191,28 +193,26 b' class changelog(revlog.revlog):' | |||||
191 | """ |
|
193 | """ | |
192 | text = self.revision(node) |
|
194 | text = self.revision(node) | |
193 | if not text: |
|
195 | if not text: | |
194 |
return (nullid, "", (0, 0), [], "", |
|
196 | return (nullid, "", (0, 0), [], "", _defaultextra) | |
195 | last = text.index("\n\n") |
|
197 | last = text.index("\n\n") | |
196 | desc = encoding.tolocal(text[last + 2:]) |
|
198 | desc = encoding.tolocal(text[last + 2:]) | |
197 | l = text[:last].split('\n') |
|
199 | l = text[:last].split('\n') | |
198 | manifest = bin(l[0]) |
|
200 | manifest = bin(l[0]) | |
199 | user = encoding.tolocal(l[1]) |
|
201 | user = encoding.tolocal(l[1]) | |
200 |
|
202 | |||
201 |
|
|
203 | tdata = l[2].split(' ', 2) | |
202 |
if len( |
|
204 | if len(tdata) != 3: | |
203 |
time = float( |
|
205 | time = float(tdata[0]) | |
204 | try: |
|
206 | try: | |
205 | # various tools did silly things with the time zone field. |
|
207 | # various tools did silly things with the time zone field. | |
206 |
timezone = int( |
|
208 | timezone = int(tdata[1]) | |
207 | except ValueError: |
|
209 | except ValueError: | |
208 | timezone = 0 |
|
210 | timezone = 0 | |
209 |
extra = |
|
211 | extra = _defaultextra | |
210 | else: |
|
212 | else: | |
211 |
time, timezone |
|
213 | time, timezone = float(tdata[0]), int(tdata[1]) | |
212 | time, timezone = float(time), int(timezone) |
|
214 | extra = decodeextra(tdata[2]) | |
213 | extra = decodeextra(extra) |
|
215 | ||
214 | if not extra.get('branch'): |
|
|||
215 | extra['branch'] = 'default' |
|
|||
216 | files = l[3:] |
|
216 | files = l[3:] | |
217 | return (manifest, user, (time, timezone), files, desc, extra) |
|
217 | return (manifest, user, (time, timezone), files, desc, extra) | |
218 |
|
218 |
General Comments 0
You need to be logged in to leave comments.
Login now