##// END OF EJS Templates
revlog: pass around the `rev` we deal with when packing/unpacking entry...
marmoute -
r48041:55d280bc default
parent child Browse files
Show More
@@ -118,10 +118,10 b' class BaseIndexObject(object):'
118 118 def append(self, tup):
119 119 if '_nodemap' in vars(self):
120 120 self._nodemap[tup[7]] = len(self)
121 data = self._pack_entry(tup)
121 data = self._pack_entry(len(self), tup)
122 122 self._extra.append(data)
123 123
124 def _pack_entry(self, entry):
124 def _pack_entry(self, rev, entry):
125 125 assert entry[8] == 0
126 126 assert entry[9] == 0
127 127 return self.index_format.pack(*entry[:8])
@@ -141,12 +141,12 b' class BaseIndexObject(object):'
141 141 else:
142 142 index = self._calculate_index(i)
143 143 data = self._data[index : index + self.entry_size]
144 r = self._unpack_entry(data)
144 r = self._unpack_entry(i, data)
145 145 if self._lgt and i == 0:
146 146 r = (offset_type(0, gettype(r[0])),) + r[1:]
147 147 return r
148 148
149 def _unpack_entry(self, data):
149 def _unpack_entry(self, rev, data):
150 150 r = self.index_format.unpack(data)
151 151 r = r + (
152 152 0,
@@ -323,17 +323,17 b' class IndexObject2(IndexObject):'
323 323 entry[9] = sidedata_length
324 324 entry[11] = compression_mode
325 325 entry = tuple(entry)
326 new = self._pack_entry(entry)
326 new = self._pack_entry(rev, entry)
327 327 self._extra[rev - self._lgt] = new
328 328
329 def _unpack_entry(self, data):
329 def _unpack_entry(self, rev, data):
330 330 data = self.index_format.unpack(data)
331 331 entry = data[:10]
332 332 data_comp = data[10] & 3
333 333 sidedata_comp = (data[10] & (3 << 2)) >> 2
334 334 return entry + (data_comp, sidedata_comp)
335 335
336 def _pack_entry(self, entry):
336 def _pack_entry(self, rev, entry):
337 337 data = entry[:10]
338 338 data_comp = entry[10] & 3
339 339 sidedata_comp = (entry[11] & 3) << 2
@@ -344,7 +344,7 b' class IndexObject2(IndexObject):'
344 344 def entry_binary(self, rev):
345 345 """return the raw binary string representing a revision"""
346 346 entry = self[rev]
347 return self._pack_entry(entry)
347 return self._pack_entry(rev, entry)
348 348
349 349 def pack_header(self, header):
350 350 """pack header information as binary"""
General Comments 0
You need to be logged in to leave comments. Login now