comparison mercurial/utils/storageutil.py @ 49783:f064b03d061a

emitrevision: simplify the fallback to computed delta Not using the stored delta, or having a full snapshot on disk behave the same ways, so lets use the same code path for that, this is simpler, and it update will be simpler.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 28 Nov 2022 16:27:23 +0100
parents 383c79f8e5a7
children 2fd8750f3722
comparison
equal deleted inserted replaced
49782:383c79f8e5a7 49783:f064b03d061a
453 baserev = p1rev 453 baserev = p1rev
454 454
455 # There is a delta in storage. We try to use that because it 455 # There is a delta in storage. We try to use that because it
456 # amounts to effectively copying data from storage and is 456 # amounts to effectively copying data from storage and is
457 # therefore the fastest. 457 # therefore the fastest.
458 elif deltaparentrev != nullrev: 458 elif is_usable_base(deltaparentrev):
459 # If the stored delta works, let us use it ! 459 if debug_info is not None:
460 if is_usable_base(deltaparentrev): 460 debug_delta_source = "storage"
461 if debug_info is not None: 461 baserev = deltaparentrev
462 debug_delta_source = "storage" 462 else:
463 baserev = deltaparentrev 463 # No guarantee the receiver has the delta parent, or Storage has a
464 # No guarantee the receiver has the delta parent. Send delta 464 # fulltext revision.
465 # against last revision (if possible), which in the common case 465 #
466 # should be similar enough to this revision that the delta is 466 # Send delta against last revision (if possible), which in the
467 # reasonable. 467 # common case should be similar enough to this revision that the
468 # delta is reasonable.
469 if deltaparentrev != nullrev and debug_info is not None:
470 debug_info['denied-base-not-available'] += 1
468 elif prevrev is not None: 471 elif prevrev is not None:
469 if debug_info is not None: 472 if debug_info is not None:
470 debug_info['denied-base-not-available'] += 1
471 debug_delta_source = "prev" 473 debug_delta_source = "prev"
472 baserev = prevrev 474 baserev = prevrev
473 else: 475 else:
474 if debug_info is not None: 476 if debug_info is not None:
475 debug_info['denied-base-not-available'] += 1
476 debug_delta_source = "full" 477 debug_delta_source = "full"
477 baserev = nullrev 478 baserev = nullrev
478
479 # Storage has a fulltext revision.
480
481 # Let's use the previous revision, which is as good a guess as any.
482 # There is definitely room to improve this logic.
483 elif prevrev is not None:
484 if debug_info is not None:
485 debug_delta_source = "prev"
486 baserev = prevrev
487 else:
488 if debug_info is not None:
489 debug_delta_source = "full"
490 baserev = nullrev
491 479
492 # But we can't actually use our chosen delta base for whatever 480 # But we can't actually use our chosen delta base for whatever
493 # reason. Reset to fulltext. 481 # reason. Reset to fulltext.
494 if ( 482 if (
495 baserev != nullrev 483 baserev != nullrev