mercurial/pure/parsers.py
changeset 47157 47ffc754989a
parent 47156 4292bed8da7c
child 47246 6b1eae313b2f
equal deleted inserted replaced
47156:4292bed8da7c 47157:47ffc754989a
   102         return self._lgt + len(self._extra)
   102         return self._lgt + len(self._extra)
   103 
   103 
   104     def append(self, tup):
   104     def append(self, tup):
   105         if '_nodemap' in vars(self):
   105         if '_nodemap' in vars(self):
   106             self._nodemap[tup[7]] = len(self)
   106             self._nodemap[tup[7]] = len(self)
   107         data = self.index_format.pack(*tup)
   107         data = self._pack_entry(tup)
   108         self._extra.append(data)
   108         self._extra.append(data)
       
   109 
       
   110     def _pack_entry(self, entry):
       
   111         assert entry[8] == 0
       
   112         assert entry[9] == 0
       
   113         return self.index_format.pack(*entry[:8])
   109 
   114 
   110     def _check_index(self, i):
   115     def _check_index(self, i):
   111         if not isinstance(i, int):
   116         if not isinstance(i, int):
   112             raise TypeError(b"expecting int indexes")
   117             raise TypeError(b"expecting int indexes")
   113         if i < 0 or i >= len(self):
   118         if i < 0 or i >= len(self):
   296             msg = b"cannot rewrite entries outside of this transaction"
   301             msg = b"cannot rewrite entries outside of this transaction"
   297             raise KeyError(msg)
   302             raise KeyError(msg)
   298 
   303 
   299     def _unpack_entry(self, data):
   304     def _unpack_entry(self, data):
   300         return self.index_format.unpack(data)
   305         return self.index_format.unpack(data)
       
   306 
       
   307     def _pack_entry(self, entry):
       
   308         return self.index_format.pack(*entry)
   301 
   309 
   302     def entry_binary(self, rev):
   310     def entry_binary(self, rev):
   303         """return the raw binary string representing a revision"""
   311         """return the raw binary string representing a revision"""
   304         entry = self[rev]
   312         entry = self[rev]
   305         p = revlog_constants.INDEX_ENTRY_V2.pack(*entry)
   313         p = revlog_constants.INDEX_ENTRY_V2.pack(*entry)