mercurial/pure/parsers.py
changeset 47260 130c9f7ed914
parent 47255 78230d036e5d
child 47262 6bfa6c2c5f15
equal deleted inserted replaced
47259:013c645dd28c 47260:130c9f7ed914
    52     # Size of a C unsigned long long int, platform independent
    52     # Size of a C unsigned long long int, platform independent
    53     big_int_size = struct.calcsize(b'>Q')
    53     big_int_size = struct.calcsize(b'>Q')
    54     # Size of a C long int, platform independent
    54     # Size of a C long int, platform independent
    55     int_size = struct.calcsize(b'>i')
    55     int_size = struct.calcsize(b'>i')
    56     # An empty index entry, used as a default value to be overridden, or nullrev
    56     # An empty index entry, used as a default value to be overridden, or nullrev
    57     null_item = (0, 0, 0, -1, -1, -1, -1, sha1nodeconstants.nullid, 0, 0)
    57     null_item = (
       
    58         0,
       
    59         0,
       
    60         0,
       
    61         -1,
       
    62         -1,
       
    63         -1,
       
    64         -1,
       
    65         sha1nodeconstants.nullid,
       
    66         0,
       
    67         0,
       
    68         revlog_constants.COMP_MODE_INLINE,
       
    69     )
    58 
    70 
    59     @util.propertycache
    71     @util.propertycache
    60     def entry_size(self):
    72     def entry_size(self):
    61         return self.index_format.size
    73         return self.index_format.size
    62 
    74 
   133             r = (offset_type(0, gettype(r[0])),) + r[1:]
   145             r = (offset_type(0, gettype(r[0])),) + r[1:]
   134         return r
   146         return r
   135 
   147 
   136     def _unpack_entry(self, data):
   148     def _unpack_entry(self, data):
   137         r = self.index_format.unpack(data)
   149         r = self.index_format.unpack(data)
   138         r = r + (0, 0)
   150         r = r + (0, 0, revlog_constants.COMP_MODE_INLINE)
   139         return r
   151         return r
   140 
   152 
   141     def pack_header(self, header):
   153     def pack_header(self, header):
   142         """pack header information as binary"""
   154         """pack header information as binary"""
   143         v_fmt = revlog_constants.INDEX_HEADER
   155         v_fmt = revlog_constants.INDEX_HEADER
   301             entry = tuple(entry)
   313             entry = tuple(entry)
   302             new = self._pack_entry(entry)
   314             new = self._pack_entry(entry)
   303             self._extra[rev - self._lgt] = new
   315             self._extra[rev - self._lgt] = new
   304 
   316 
   305     def _unpack_entry(self, data):
   317     def _unpack_entry(self, data):
   306         return self.index_format.unpack(data)
   318         return self.index_format.unpack(data) + (
       
   319             revlog_constants.COMP_MODE_INLINE,
       
   320         )
   307 
   321 
   308     def _pack_entry(self, entry):
   322     def _pack_entry(self, entry):
   309         return self.index_format.pack(*entry)
   323         return self.index_format.pack(*entry[:10])
   310 
   324 
   311     def entry_binary(self, rev):
   325     def entry_binary(self, rev):
   312         """return the raw binary string representing a revision"""
   326         """return the raw binary string representing a revision"""
   313         entry = self[rev]
   327         entry = self[rev]
   314         p = revlog_constants.INDEX_ENTRY_V2.pack(*entry)
   328         return self._pack_entry(entry)
   315         return p
       
   316 
   329 
   317     def pack_header(self, header):
   330     def pack_header(self, header):
   318         """pack header information as binary"""
   331         """pack header information as binary"""
   319         msg = 'version header should go in the docket, not the index: %d'
   332         msg = 'version header should go in the docket, not the index: %d'
   320         msg %= header
   333         msg %= header