mercurial/revlogutils/constants.py
changeset 47393 7a0ec25d5836
parent 47371 298d4400ea68
child 47395 a669404f0f4a
equal deleted inserted replaced
47392:8089d0fa8400 47393:7a0ec25d5836
    24     KIND_CHANGELOG,
    24     KIND_CHANGELOG,
    25     KIND_MANIFESTLOG,
    25     KIND_MANIFESTLOG,
    26     KIND_FILELOG,
    26     KIND_FILELOG,
    27     KIND_OTHER,
    27     KIND_OTHER,
    28 }
    28 }
       
    29 
       
    30 ### Index entry key
       
    31 #
       
    32 #
       
    33 #    Internal details
       
    34 #    ----------------
       
    35 #
       
    36 #    A large part of the revlog logic deals with revisions' "index entries", tuple
       
    37 #    objects that contains the same "items" whatever the revlog version.
       
    38 #    Different versions will have different ways of storing these items (sometimes
       
    39 #    not having them at all), but the tuple will always be the same. New fields
       
    40 #    are usually added at the end to avoid breaking existing code that relies
       
    41 #    on the existing order. The field are defined as follows:
       
    42 
       
    43 #    [0] offset:
       
    44 #            The byte index of the start of revision data chunk.
       
    45 #            That value is shifted up by 16 bits. use "offset = field >> 16" to
       
    46 #            retrieve it.
       
    47 #
       
    48 #        flags:
       
    49 #            A flag field that carries special information or changes the behavior
       
    50 #            of the revision. (see `REVIDX_*` constants for details)
       
    51 #            The flag field only occupies the first 16 bits of this field,
       
    52 #            use "flags = field & 0xFFFF" to retrieve the value.
       
    53 ENTRY_DATA_OFFSET = 0
       
    54 
       
    55 #    [1] compressed length:
       
    56 #            The size, in bytes, of the chunk on disk
       
    57 ENTRY_DATA_COMPRESSED_LENGTH = 1
       
    58 
       
    59 #    [2] uncompressed length:
       
    60 #            The size, in bytes, of the full revision once reconstructed.
       
    61 ENTRY_DATA_UNCOMPRESSED_LENGTH = 2
       
    62 
       
    63 #    [3] base rev:
       
    64 #            Either the base of the revision delta chain (without general
       
    65 #            delta), or the base of the delta (stored in the data chunk)
       
    66 #            with general delta.
       
    67 ENTRY_DELTA_BASE = 3
       
    68 
       
    69 #    [4] link rev:
       
    70 #            Changelog revision number of the changeset introducing this
       
    71 #            revision.
       
    72 ENTRY_LINK_REV = 4
       
    73 
       
    74 #    [5] parent 1 rev:
       
    75 #            Revision number of the first parent
       
    76 ENTRY_PARENT_1 = 5
       
    77 
       
    78 #    [6] parent 2 rev:
       
    79 #            Revision number of the second parent
       
    80 ENTRY_PARENT_2 = 6
       
    81 
       
    82 #    [7] node id:
       
    83 #            The node id of the current revision
       
    84 ENTRY_NODE_ID = 7
       
    85 
       
    86 #    [8] sidedata offset:
       
    87 #            The byte index of the start of the revision's side-data chunk.
       
    88 ENTRY_SIDEDATA_OFFSET = 8
       
    89 
       
    90 #    [9] sidedata chunk length:
       
    91 #            The size, in bytes, of the revision's side-data chunk.
       
    92 ENTRY_SIDEDATA_COMPRESSED_LENGTH = 9
       
    93 
       
    94 #    [10] data compression mode:
       
    95 #            two bits that detail the way the data chunk is compressed on disk.
       
    96 #            (see "COMP_MODE_*" constants for details). For revlog version 0 and
       
    97 #            1 this will always be COMP_MODE_INLINE.
       
    98 ENTRY_DATA_COMPRESSION_MODE = 10
       
    99 
       
   100 #    [11] side-data compression mode:
       
   101 #            two bits that detail the way the sidedata chunk is compressed on disk.
       
   102 #            (see "COMP_MODE_*" constants for details)
       
   103 ENTRY_SIDEDATA_COMPRESSION_MODE = 11
    29 
   104 
    30 ### main revlog header
   105 ### main revlog header
    31 
   106 
    32 # We cannot rely on  Struct.format is inconsistent for python <=3.6 versus above
   107 # We cannot rely on  Struct.format is inconsistent for python <=3.6 versus above
    33 INDEX_HEADER_FMT = b">I"
   108 INDEX_HEADER_FMT = b">I"