##// END OF EJS Templates
revlog: simplify the replace_sidedata_info code...
marmoute -
r48018:78230d03 default
parent child Browse files
Show More
@@ -290,17 +290,17 b' class Index2Mixin(object):'
290 if rev < 0:
290 if rev < 0:
291 raise KeyError
291 raise KeyError
292 self._check_index(rev)
292 self._check_index(rev)
293 sidedata_format = b">Qi"
293 if rev < self._lgt:
294 packed_size = struct.calcsize(sidedata_format)
295 if rev >= self._lgt:
296 packed = _pack(sidedata_format, sidedata_offset, sidedata_length)
297 old = self._extra[rev - self._lgt]
298 offset_flags = struct.pack(b">Q", offset_flags)
299 new = offset_flags + old[8:64] + packed + old[64 + packed_size :]
300 self._extra[rev - self._lgt] = new
301 else:
302 msg = b"cannot rewrite entries outside of this transaction"
294 msg = b"cannot rewrite entries outside of this transaction"
303 raise KeyError(msg)
295 raise KeyError(msg)
296 else:
297 entry = list(self[rev])
298 entry[0] = offset_flags
299 entry[8] = sidedata_offset
300 entry[9] = sidedata_length
301 entry = tuple(entry)
302 new = self._pack_entry(entry)
303 self._extra[rev - self._lgt] = new
304
304
305 def _unpack_entry(self, data):
305 def _unpack_entry(self, data):
306 return self.index_format.unpack(data)
306 return self.index_format.unpack(data)
General Comments 0
You need to be logged in to leave comments. Login now