Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/utils/storageutil.py @ 49784:2fd8750f3722
emitrevision: if we need to compute a delta on the fly, try p1 or p2 first
Falling back to `prev` does not yield any real value on modern storage and
result in pathological changes to be created on the other side. Doing a delta
against a parent will likely be smaller (helping the network) and will be safer
to apply on the client (helping future pulls by Triggering intermediate
snapshop where they will be needed by later deltas).
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 24 Nov 2022 04:04:19 +0100 |
parents | f064b03d061a |
children | e92de86cf4f8 |
comparison
equal
deleted
inserted
replaced
49783:f064b03d061a | 49784:2fd8750f3722 |
---|---|
458 elif is_usable_base(deltaparentrev): | 458 elif is_usable_base(deltaparentrev): |
459 if debug_info is not None: | 459 if debug_info is not None: |
460 debug_delta_source = "storage" | 460 debug_delta_source = "storage" |
461 baserev = deltaparentrev | 461 baserev = deltaparentrev |
462 else: | 462 else: |
463 if deltaparentrev != nullrev and debug_info is not None: | |
464 debug_info['denied-base-not-available'] += 1 | |
463 # No guarantee the receiver has the delta parent, or Storage has a | 465 # No guarantee the receiver has the delta parent, or Storage has a |
464 # fulltext revision. | 466 # fulltext revision. |
465 # | 467 # |
466 # Send delta against last revision (if possible), which in the | 468 # We compute a delta on the fly to send over the wire. |
467 # common case should be similar enough to this revision that the | 469 # |
468 # delta is reasonable. | 470 # We start with a try against p1, which in the common case should |
469 if deltaparentrev != nullrev and debug_info is not None: | 471 # be close to this revision content. |
470 debug_info['denied-base-not-available'] += 1 | 472 # |
473 # note: we could optimize between p1 and p2 in merges cases. | |
474 elif is_usable_base(p1rev): | |
475 if debug_info is not None: | |
476 debug_delta_source = "p1" | |
477 baserev = p1rev | |
478 # if p1 was not an option, try p2 | |
479 elif is_usable_base(p2rev): | |
480 if debug_info is not None: | |
481 debug_delta_source = "p2" | |
482 baserev = p2rev | |
483 # Send delta against prev in despair | |
484 # | |
485 # using the closest available ancestors first might be better? | |
471 elif prevrev is not None: | 486 elif prevrev is not None: |
472 if debug_info is not None: | 487 if debug_info is not None: |
473 debug_delta_source = "prev" | 488 debug_delta_source = "prev" |
474 baserev = prevrev | 489 baserev = prevrev |
475 else: | 490 else: |