##// END OF EJS Templates
revlog: move the "index header" struct inside revlog.utils.constants...
marmoute -
r47618:c6e23fb4 default
parent child Browse files
Show More
@@ -44,6 +44,7 b' from .revlogutils.constants import ('
44 INDEX_ENTRY_V0,
44 INDEX_ENTRY_V0,
45 INDEX_ENTRY_V1,
45 INDEX_ENTRY_V1,
46 INDEX_ENTRY_V2,
46 INDEX_ENTRY_V2,
47 INDEX_HEADER,
47 REVLOGV0,
48 REVLOGV0,
48 REVLOGV1,
49 REVLOGV1,
49 REVLOGV1_FLAGS,
50 REVLOGV1_FLAGS,
@@ -327,10 +328,6 b' class revlogoldio(object):'
327 return INDEX_ENTRY_V0.pack(*e2)
328 return INDEX_ENTRY_V0.pack(*e2)
328
329
329
330
330 versionformat = struct.Struct(b">I")
331 versionformat_pack = versionformat.pack
332 versionformat_unpack = versionformat.unpack
333
334 # corresponds to uncompressed length of indexformatng (2 gigs, 4-byte
331 # corresponds to uncompressed length of indexformatng (2 gigs, 4-byte
335 # signed integer)
332 # signed integer)
336 _maxentrysize = 0x7FFFFFFF
333 _maxentrysize = 0x7FFFFFFF
@@ -348,7 +345,7 b' class revlogio(object):'
348 def packentry(self, entry, node, version, rev):
345 def packentry(self, entry, node, version, rev):
349 p = INDEX_ENTRY_V1.pack(*entry)
346 p = INDEX_ENTRY_V1.pack(*entry)
350 if rev == 0:
347 if rev == 0:
351 p = versionformat_pack(version) + p[4:]
348 p = INDEX_HEADER.pack(version) + p[4:]
352 return p
349 return p
353
350
354
351
@@ -363,7 +360,7 b' class revlogv2io(object):'
363 def packentry(self, entry, node, version, rev):
360 def packentry(self, entry, node, version, rev):
364 p = INDEX_ENTRY_V2.pack(*entry)
361 p = INDEX_ENTRY_V2.pack(*entry)
365 if rev == 0:
362 if rev == 0:
366 p = versionformat_pack(version) + p[4:]
363 p = INDEX_HEADER.pack(version) + p[4:]
367 return p
364 return p
368
365
369
366
@@ -579,7 +576,7 b' class revlog(object):'
579 else:
576 else:
580 indexdata = f.read()
577 indexdata = f.read()
581 if len(indexdata) > 0:
578 if len(indexdata) > 0:
582 versionflags = versionformat_unpack(indexdata[:4])[0]
579 versionflags = INDEX_HEADER.unpack(indexdata[:4])[0]
583 self._initempty = False
580 self._initempty = False
584 else:
581 else:
585 versionflags = newversionflags
582 versionflags = newversionflags
@@ -15,6 +15,8 b' from ..interfaces import repository'
15
15
16 ### main revlog header
16 ### main revlog header
17
17
18 INDEX_HEADER = struct.Struct(b">I")
19
18 ## revlog version
20 ## revlog version
19 REVLOGV0 = 0
21 REVLOGV0 = 0
20 REVLOGV1 = 1
22 REVLOGV1 = 1
General Comments 0
You need to be logged in to leave comments. Login now