mercurial/pure/parsers.py
changeset 48537 c5d6c874766a
parent 48536 52034c42c09d
child 48564 c514936d92b4
equal deleted inserted replaced
48536:52034c42c09d 48537:c5d6c874766a
   878 
   878 
   879 
   879 
   880 class IndexChangelogV2(IndexObject2):
   880 class IndexChangelogV2(IndexObject2):
   881     index_format = revlog_constants.INDEX_ENTRY_CL_V2
   881     index_format = revlog_constants.INDEX_ENTRY_CL_V2
   882 
   882 
       
   883     null_item = (
       
   884         IndexObject2.null_item[: revlog_constants.ENTRY_RANK]
       
   885         + (0,)  # rank of null is 0
       
   886         + IndexObject2.null_item[revlog_constants.ENTRY_RANK :]
       
   887     )
       
   888 
   883     def _unpack_entry(self, rev, data, r=True):
   889     def _unpack_entry(self, rev, data, r=True):
   884         items = self.index_format.unpack(data)
   890         items = self.index_format.unpack(data)
   885         return (
   891         return (
   886             items[revlog_constants.INDEX_ENTRY_V2_IDX_OFFSET],
   892             items[revlog_constants.INDEX_ENTRY_V2_IDX_OFFSET],
   887             items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSED_LENGTH],
   893             items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSED_LENGTH],
   896                 revlog_constants.INDEX_ENTRY_V2_IDX_SIDEDATA_COMPRESSED_LENGTH
   902                 revlog_constants.INDEX_ENTRY_V2_IDX_SIDEDATA_COMPRESSED_LENGTH
   897             ],
   903             ],
   898             items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] & 3,
   904             items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] & 3,
   899             (items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] >> 2)
   905             (items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] >> 2)
   900             & 3,
   906             & 3,
   901             revlog_constants.RANK_UNKNOWN,
   907             items[revlog_constants.INDEX_ENTRY_V2_IDX_RANK],
   902         )
   908         )
   903 
   909 
   904     def _pack_entry(self, rev, entry):
   910     def _pack_entry(self, rev, entry):
   905 
   911 
   906         base = entry[revlog_constants.ENTRY_DELTA_BASE]
   912         base = entry[revlog_constants.ENTRY_DELTA_BASE]
   917             entry[revlog_constants.ENTRY_SIDEDATA_OFFSET],
   923             entry[revlog_constants.ENTRY_SIDEDATA_OFFSET],
   918             entry[revlog_constants.ENTRY_SIDEDATA_COMPRESSED_LENGTH],
   924             entry[revlog_constants.ENTRY_SIDEDATA_COMPRESSED_LENGTH],
   919             entry[revlog_constants.ENTRY_DATA_COMPRESSION_MODE] & 3
   925             entry[revlog_constants.ENTRY_DATA_COMPRESSION_MODE] & 3
   920             | (entry[revlog_constants.ENTRY_SIDEDATA_COMPRESSION_MODE] & 3)
   926             | (entry[revlog_constants.ENTRY_SIDEDATA_COMPRESSION_MODE] & 3)
   921             << 2,
   927             << 2,
       
   928             entry[revlog_constants.ENTRY_RANK],
   922         )
   929         )
   923         return self.index_format.pack(*data)
   930         return self.index_format.pack(*data)
   924 
   931 
   925 
   932 
   926 def parse_index_devel_nodemap(data, inline):
   933 def parse_index_devel_nodemap(data, inline):