Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/utils/storageutil.py @ 49609:31b4675ca998 stable
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 | bb2c663c840f |
children | f463eb675e85 |
comparison
equal
deleted
inserted
replaced
49608:bb2c663c840f | 49609:31b4675ca998 |
---|---|
434 baserev = deltaparentrev | 434 baserev = deltaparentrev |
435 else: | 435 else: |
436 # No guarantee the receiver has the delta parent, or Storage has a | 436 # No guarantee the receiver has the delta parent, or Storage has a |
437 # fulltext revision. | 437 # fulltext revision. |
438 # | 438 # |
439 # Send delta against last revision (if possible), which in the | 439 # We compute a delta on the fly to send over the wire. |
440 # common case should be similar enough to this revision that the | 440 # |
441 # delta is reasonable. | 441 # We start with a try against p1, which in the common case should |
442 if prevrev is not None: | 442 # be close to this revision content. |
443 # | |
444 # note: we could optimize between p1 and p2 in merges cases. | |
445 if is_usable_base(p1rev): | |
446 baserev = p1rev | |
447 # if p1 was not an option, try p2 | |
448 elif is_usable_base(p2rev): | |
449 baserev = p2rev | |
450 # Send delta against prev in despair | |
451 # | |
452 # using the closest available ancestors first might be better? | |
453 elif prevrev is not None: | |
443 baserev = prevrev | 454 baserev = prevrev |
444 else: | 455 else: |
445 baserev = nullrev | 456 baserev = nullrev |
446 | 457 |
447 # But we can't actually use our chosen delta base for whatever | 458 # But we can't actually use our chosen delta base for whatever |