equal
deleted
inserted
replaced
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 INDEX_ENTRY_V0, |
45 INDEX_ENTRY_V1, |
45 INDEX_ENTRY_V1, |
|
46 INDEX_ENTRY_V2, |
46 REVLOGV0, |
47 REVLOGV0, |
47 REVLOGV1, |
48 REVLOGV1, |
48 REVLOGV1_FLAGS, |
49 REVLOGV1_FLAGS, |
49 REVLOGV2, |
50 REVLOGV2, |
50 REVLOGV2_FLAGS, |
51 REVLOGV2_FLAGS, |
85 ) |
86 ) |
86 from .utils import ( |
87 from .utils import ( |
87 storageutil, |
88 storageutil, |
88 stringutil, |
89 stringutil, |
89 ) |
90 ) |
90 from .pure import parsers as pureparsers |
|
91 |
91 |
92 # blanked usage of all the name to prevent pyflakes constraints |
92 # blanked usage of all the name to prevent pyflakes constraints |
93 # We need these name available in the module for extensions. |
93 # We need these name available in the module for extensions. |
94 REVLOGV0 |
94 REVLOGV0 |
95 REVLOGV1 |
95 REVLOGV1 |
350 if rev == 0: |
350 if rev == 0: |
351 p = versionformat_pack(version) + p[4:] |
351 p = versionformat_pack(version) + p[4:] |
352 return p |
352 return p |
353 |
353 |
354 |
354 |
355 indexformatv2 = struct.Struct(pureparsers.Index2Mixin.index_format) |
|
356 indexformatv2_pack = indexformatv2.pack |
|
357 |
|
358 |
|
359 class revlogv2io(object): |
355 class revlogv2io(object): |
360 def __init__(self): |
356 def __init__(self): |
361 self.size = indexformatv2.size |
357 self.size = INDEX_ENTRY_V2.size |
362 |
358 |
363 def parseindex(self, data, inline): |
359 def parseindex(self, data, inline): |
364 index, cache = parsers.parse_index2(data, inline, revlogv2=True) |
360 index, cache = parsers.parse_index2(data, inline, revlogv2=True) |
365 return index, cache |
361 return index, cache |
366 |
362 |
367 def packentry(self, entry, node, version, rev): |
363 def packentry(self, entry, node, version, rev): |
368 p = indexformatv2_pack(*entry) |
364 p = INDEX_ENTRY_V2.pack(*entry) |
369 if rev == 0: |
365 if rev == 0: |
370 p = versionformat_pack(version) + p[4:] |
366 p = versionformat_pack(version) + p[4:] |
371 return p |
367 return p |
372 |
368 |
373 |
369 |