Show More
@@ -15,17 +15,30 b' from i18n import _' | |||
|
15 | 15 | import binascii, changegroup, errno, ancestor, mdiff, os |
|
16 | 16 | import sha, struct, util, zlib |
|
17 | 17 | |
|
18 | # revlog version strings | |
|
18 | # revlog flags | |
|
19 | 19 | REVLOGV0 = 0 |
|
20 | 20 | REVLOGNG = 1 |
|
21 | ||
|
22 | # revlog flags | |
|
23 | 21 | REVLOGNGINLINEDATA = (1 << 16) |
|
24 | 22 | REVLOG_DEFAULT_FLAGS = REVLOGNGINLINEDATA |
|
25 | ||
|
26 | 23 | REVLOG_DEFAULT_FORMAT = REVLOGNG |
|
27 | 24 | REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS |
|
28 | 25 | |
|
26 | class RevlogError(Exception): | |
|
27 | pass | |
|
28 | class LookupError(RevlogError): | |
|
29 | pass | |
|
30 | ||
|
31 | def getoffset(q): | |
|
32 | if q & 0xFFFF: | |
|
33 | raise RevlogError(_('incompatible revision flag %x') % q) | |
|
34 | return int(q >> 16) | |
|
35 | ||
|
36 | def gettype(q): | |
|
37 | return int(q & 0xFFFF) | |
|
38 | ||
|
39 | def offset_type(offset, type): | |
|
40 | return long(long(offset) << 16 | type) | |
|
41 | ||
|
29 | 42 | def hash(text, p1, p2): |
|
30 | 43 | """generate a hash from the given text and its parent hashes |
|
31 | 44 | |
@@ -68,22 +81,6 b' def decompress(bin):' | |||
|
68 | 81 | return bin[1:] |
|
69 | 82 | raise RevlogError(_("unknown compression type %r") % t) |
|
70 | 83 | |
|
71 | indexformatv0 = ">4l20s20s20s" | |
|
72 | v0shaoffset = 56 | |
|
73 | # index ng: | |
|
74 | # 6 bytes offset | |
|
75 | # 2 bytes flags | |
|
76 | # 4 bytes compressed length | |
|
77 | # 4 bytes uncompressed length | |
|
78 | # 4 bytes: base rev | |
|
79 | # 4 bytes link rev | |
|
80 | # 4 bytes parent 1 rev | |
|
81 | # 4 bytes parent 2 rev | |
|
82 | # 32 bytes: nodeid | |
|
83 | indexformatng = ">Qiiiiii20s12x" | |
|
84 | ngshaoffset = 32 | |
|
85 | versionformat = ">I" | |
|
86 | ||
|
87 | 84 | class lazyparser(object): |
|
88 | 85 | """ |
|
89 | 86 | this class avoids the need to parse the entirety of large indices |
@@ -289,21 +286,8 b' class lazymap(object):' | |||
|
289 | 286 | def __delitem__(self, key): |
|
290 | 287 | del self.p.map[key] |
|
291 | 288 | |
|
292 | class RevlogError(Exception): | |
|
293 | pass | |
|
294 | class LookupError(RevlogError): | |
|
295 | pass | |
|
296 | ||
|
297 | def getoffset(q): | |
|
298 | if q & 0xFFFF: | |
|
299 | raise RevlogError(_('incompatible revision flag %x') % q) | |
|
300 | return int(q >> 16) | |
|
301 | ||
|
302 | def gettype(q): | |
|
303 | return int(q & 0xFFFF) | |
|
304 | ||
|
305 | def offset_type(offset, type): | |
|
306 | return long(long(offset) << 16 | type) | |
|
289 | indexformatv0 = ">4l20s20s20s" | |
|
290 | v0shaoffset = 56 | |
|
307 | 291 | |
|
308 | 292 | class revlogoldio(object): |
|
309 | 293 | def __init__(self): |
@@ -334,6 +318,20 b' class revlogoldio(object):' | |||
|
334 | 318 | node(entry[5]), node(entry[6]), entry[7]) |
|
335 | 319 | return struct.pack(indexformatv0, *e2) |
|
336 | 320 | |
|
321 | # index ng: | |
|
322 | # 6 bytes offset | |
|
323 | # 2 bytes flags | |
|
324 | # 4 bytes compressed length | |
|
325 | # 4 bytes uncompressed length | |
|
326 | # 4 bytes: base rev | |
|
327 | # 4 bytes link rev | |
|
328 | # 4 bytes parent 1 rev | |
|
329 | # 4 bytes parent 2 rev | |
|
330 | # 32 bytes: nodeid | |
|
331 | indexformatng = ">Qiiiiii20s12x" | |
|
332 | ngshaoffset = 32 | |
|
333 | versionformat = ">I" | |
|
334 | ||
|
337 | 335 | class revlogio(object): |
|
338 | 336 | def __init__(self): |
|
339 | 337 | self.size = struct.calcsize(indexformatng) |
@@ -1253,5 +1251,3 b' class revlog(object):' | |||
|
1253 | 1251 | di = 0 |
|
1254 | 1252 | |
|
1255 | 1253 | return (dd, di) |
|
1256 | ||
|
1257 |
General Comments 0
You need to be logged in to leave comments.
Login now