Show More
@@ -41,6 +41,7 b' from .pycompat import getattr' | |||||
41 | from .revlogutils.constants import ( |
|
41 | from .revlogutils.constants import ( | |
42 | FLAG_GENERALDELTA, |
|
42 | FLAG_GENERALDELTA, | |
43 | FLAG_INLINE_DATA, |
|
43 | FLAG_INLINE_DATA, | |
|
44 | INDEX_ENTRY_V0, | |||
44 | REVLOGV0, |
|
45 | REVLOGV0, | |
45 | REVLOGV1, |
|
46 | REVLOGV1, | |
46 | REVLOGV1_FLAGS, |
|
47 | REVLOGV1_FLAGS, | |
@@ -218,19 +219,6 b' class revlogproblem(object):' | |||||
218 | node = attr.ib(default=None) |
|
219 | node = attr.ib(default=None) | |
219 |
|
220 | |||
220 |
|
221 | |||
221 | # index v0: |
|
|||
222 | # 4 bytes: offset |
|
|||
223 | # 4 bytes: compressed length |
|
|||
224 | # 4 bytes: base rev |
|
|||
225 | # 4 bytes: link rev |
|
|||
226 | # 20 bytes: parent 1 nodeid |
|
|||
227 | # 20 bytes: parent 2 nodeid |
|
|||
228 | # 20 bytes: nodeid |
|
|||
229 | indexformatv0 = struct.Struct(b">4l20s20s20s") |
|
|||
230 | indexformatv0_pack = indexformatv0.pack |
|
|||
231 | indexformatv0_unpack = indexformatv0.unpack |
|
|||
232 |
|
||||
233 |
|
||||
234 | class revlogoldindex(list): |
|
222 | class revlogoldindex(list): | |
235 | @property |
|
223 | @property | |
236 | def nodemap(self): |
|
224 | def nodemap(self): | |
@@ -284,7 +272,7 b' class revlogoldindex(list):' | |||||
284 |
|
272 | |||
285 | class revlogoldio(object): |
|
273 | class revlogoldio(object): | |
286 | def __init__(self): |
|
274 | def __init__(self): | |
287 |
self.size = |
|
275 | self.size = INDEX_ENTRY_V0.size | |
288 |
|
276 | |||
289 | def parseindex(self, data, inline): |
|
277 | def parseindex(self, data, inline): | |
290 | s = self.size |
|
278 | s = self.size | |
@@ -295,7 +283,7 b' class revlogoldio(object):' | |||||
295 | while off + s <= l: |
|
283 | while off + s <= l: | |
296 | cur = data[off : off + s] |
|
284 | cur = data[off : off + s] | |
297 | off += s |
|
285 | off += s | |
298 |
e = |
|
286 | e = INDEX_ENTRY_V0.unpack(cur) | |
299 | # transform to revlogv1 format |
|
287 | # transform to revlogv1 format | |
300 | e2 = ( |
|
288 | e2 = ( | |
301 | offset_type(e[0], 0), |
|
289 | offset_type(e[0], 0), | |
@@ -315,6 +303,13 b' class revlogoldio(object):' | |||||
315 | return index, None |
|
303 | return index, None | |
316 |
|
304 | |||
317 | def packentry(self, entry, node, version, rev): |
|
305 | def packentry(self, entry, node, version, rev): | |
|
306 | """return the binary representation of an entry | |||
|
307 | ||||
|
308 | entry: a tuple containing all the values (see index.__getitem__) | |||
|
309 | node: a callback to convert a revision to nodeid | |||
|
310 | version: the changelog version | |||
|
311 | rev: the revision number | |||
|
312 | """ | |||
318 | if gettype(entry[0]): |
|
313 | if gettype(entry[0]): | |
319 | raise error.RevlogError( |
|
314 | raise error.RevlogError( | |
320 | _(b'index entry flags need revlog version 1') |
|
315 | _(b'index entry flags need revlog version 1') | |
@@ -328,7 +323,7 b' class revlogoldio(object):' | |||||
328 | node(entry[6]), |
|
323 | node(entry[6]), | |
329 | entry[7], |
|
324 | entry[7], | |
330 | ) |
|
325 | ) | |
331 |
return |
|
326 | return INDEX_ENTRY_V0.pack(*e2) | |
332 |
|
327 | |||
333 |
|
328 | |||
334 | # index ng: |
|
329 | # index ng: |
@@ -9,6 +9,8 b'' | |||||
9 |
|
9 | |||
10 | from __future__ import absolute_import |
|
10 | from __future__ import absolute_import | |
11 |
|
11 | |||
|
12 | import struct | |||
|
13 | ||||
12 | from ..interfaces import repository |
|
14 | from ..interfaces import repository | |
13 |
|
15 | |||
14 | ### main revlog header |
|
16 | ### main revlog header | |
@@ -32,6 +34,16 b' REVLOGV2_FLAGS = FLAG_INLINE_DATA' | |||||
32 |
|
34 | |||
33 | ### individual entry |
|
35 | ### individual entry | |
34 |
|
36 | |||
|
37 | ## index v0: | |||
|
38 | # 4 bytes: offset | |||
|
39 | # 4 bytes: compressed length | |||
|
40 | # 4 bytes: base rev | |||
|
41 | # 4 bytes: link rev | |||
|
42 | # 20 bytes: parent 1 nodeid | |||
|
43 | # 20 bytes: parent 2 nodeid | |||
|
44 | # 20 bytes: nodeid | |||
|
45 | INDEX_ENTRY_V0 = struct.Struct(b">4l20s20s20s") | |||
|
46 | ||||
35 | # revlog index flags |
|
47 | # revlog index flags | |
36 |
|
48 | |||
37 | # For historical reasons, revlog's internal flags were exposed via the |
|
49 | # For historical reasons, revlog's internal flags were exposed via the |
General Comments 0
You need to be logged in to leave comments.
Login now