##// END OF EJS Templates
revlog: use `rev` instead of `i` in replace_sidedata_info...
marmoute -
r48017:3b04cf97 default
parent child Browse files
Show More
@@ -279,25 +279,25 b' class Index2Mixin(object):'
279 index_format = revlog_constants.INDEX_ENTRY_V2
279 index_format = revlog_constants.INDEX_ENTRY_V2
280
280
281 def replace_sidedata_info(
281 def replace_sidedata_info(
282 self, i, sidedata_offset, sidedata_length, offset_flags
282 self, rev, sidedata_offset, sidedata_length, offset_flags
283 ):
283 ):
284 """
284 """
285 Replace an existing index entry's sidedata offset and length with new
285 Replace an existing index entry's sidedata offset and length with new
286 ones.
286 ones.
287 This cannot be used outside of the context of sidedata rewriting,
287 This cannot be used outside of the context of sidedata rewriting,
288 inside the transaction that creates the revision `i`.
288 inside the transaction that creates the revision `rev`.
289 """
289 """
290 if i < 0:
290 if rev < 0:
291 raise KeyError
291 raise KeyError
292 self._check_index(i)
292 self._check_index(rev)
293 sidedata_format = b">Qi"
293 sidedata_format = b">Qi"
294 packed_size = struct.calcsize(sidedata_format)
294 packed_size = struct.calcsize(sidedata_format)
295 if i >= self._lgt:
295 if rev >= self._lgt:
296 packed = _pack(sidedata_format, sidedata_offset, sidedata_length)
296 packed = _pack(sidedata_format, sidedata_offset, sidedata_length)
297 old = self._extra[i - self._lgt]
297 old = self._extra[rev - self._lgt]
298 offset_flags = struct.pack(b">Q", offset_flags)
298 offset_flags = struct.pack(b">Q", offset_flags)
299 new = offset_flags + old[8:64] + packed + old[64 + packed_size :]
299 new = offset_flags + old[8:64] + packed + old[64 + packed_size :]
300 self._extra[i - self._lgt] = new
300 self._extra[rev - self._lgt] = new
301 else:
301 else:
302 msg = b"cannot rewrite entries outside of this transaction"
302 msg = b"cannot rewrite entries outside of this transaction"
303 raise KeyError(msg)
303 raise KeyError(msg)
General Comments 0
You need to be logged in to leave comments. Login now