comparison mercurial/utils/storageutil.py @ 49608:bb2c663c840f stable

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 0bda07f34c01
children 31b4675ca998
comparison
equal deleted inserted replaced
49607:0bda07f34c01 49608:bb2c663c840f
428 baserev = p1rev 428 baserev = p1rev
429 429
430 # There is a delta in storage. We try to use that because it 430 # There is a delta in storage. We try to use that because it
431 # amounts to effectively copying data from storage and is 431 # amounts to effectively copying data from storage and is
432 # therefore the fastest. 432 # therefore the fastest.
433 elif deltaparentrev != nullrev: 433 elif is_usable_base(deltaparentrev):
434 # If the stored delta works, let us use it ! 434 baserev = deltaparentrev
435 if is_usable_base(deltaparentrev): 435 else:
436 baserev = deltaparentrev 436 # No guarantee the receiver has the delta parent, or Storage has a
437 # No guarantee the receiver has the delta parent. Send delta 437 # fulltext revision.
438 # against last revision (if possible), which in the common case 438 #
439 # should be similar enough to this revision that the delta is 439 # Send delta against last revision (if possible), which in the
440 # reasonable. 440 # common case should be similar enough to this revision that the
441 elif prevrev is not None: 441 # delta is reasonable.
442 if prevrev is not None:
442 baserev = prevrev 443 baserev = prevrev
443 else: 444 else:
444 baserev = nullrev 445 baserev = nullrev
445
446 # Storage has a fulltext revision.
447
448 # Let's use the previous revision, which is as good a guess as any.
449 # There is definitely room to improve this logic.
450 elif prevrev is not None:
451 baserev = prevrev
452 else:
453 baserev = nullrev
454 446
455 # But we can't actually use our chosen delta base for whatever 447 # But we can't actually use our chosen delta base for whatever
456 # reason. Reset to fulltext. 448 # reason. Reset to fulltext.
457 if baserev != nullrev and (candeltafn and not candeltafn(baserev, rev)): 449 if baserev != nullrev and (candeltafn and not candeltafn(baserev, rev)):
458 baserev = nullrev 450 baserev = nullrev