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