equal
deleted
inserted
replaced
3379 ) |
3379 ) |
3380 |
3380 |
3381 serialized_sidedata = sidedatautil.serialize_sidedata( |
3381 serialized_sidedata = sidedatautil.serialize_sidedata( |
3382 new_sidedata |
3382 new_sidedata |
3383 ) |
3383 ) |
|
3384 |
|
3385 sidedata_compression_mode = COMP_MODE_INLINE |
|
3386 if serialized_sidedata and self.hassidedata: |
|
3387 sidedata_compression_mode = COMP_MODE_PLAIN |
|
3388 h, comp_sidedata = self.compress(serialized_sidedata) |
|
3389 if ( |
|
3390 h != b'u' |
|
3391 and comp_sidedata[0] != b'\0' |
|
3392 and len(comp_sidedata) < len(serialized_sidedata) |
|
3393 ): |
|
3394 assert not h |
|
3395 if ( |
|
3396 comp_sidedata[0] |
|
3397 == self._docket.default_compression_header |
|
3398 ): |
|
3399 sidedata_compression_mode = COMP_MODE_DEFAULT |
|
3400 serialized_sidedata = comp_sidedata |
|
3401 else: |
|
3402 sidedata_compression_mode = COMP_MODE_INLINE |
|
3403 serialized_sidedata = comp_sidedata |
3384 if entry[8] != 0 or entry[9] != 0: |
3404 if entry[8] != 0 or entry[9] != 0: |
3385 # rewriting entries that already have sidedata is not |
3405 # rewriting entries that already have sidedata is not |
3386 # supported yet, because it introduces garbage data in the |
3406 # supported yet, because it introduces garbage data in the |
3387 # revlog. |
3407 # revlog. |
3388 msg = b"rewriting existing sidedata is not supported yet" |
3408 msg = b"rewriting existing sidedata is not supported yet" |
3393 new_offset_flags = entry[0] | flags[0] & ~flags[1] |
3413 new_offset_flags = entry[0] | flags[0] & ~flags[1] |
3394 entry_update = ( |
3414 entry_update = ( |
3395 current_offset, |
3415 current_offset, |
3396 len(serialized_sidedata), |
3416 len(serialized_sidedata), |
3397 new_offset_flags, |
3417 new_offset_flags, |
|
3418 sidedata_compression_mode, |
3398 ) |
3419 ) |
3399 |
3420 |
3400 # the sidedata computation might have move the file cursors around |
3421 # the sidedata computation might have move the file cursors around |
3401 dfh.seek(current_offset, os.SEEK_SET) |
3422 dfh.seek(current_offset, os.SEEK_SET) |
3402 dfh.write(serialized_sidedata) |
3423 dfh.write(serialized_sidedata) |