changeset 49787: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
files mercurial/utils/storageutil.py
diffstat 1 files changed, 10 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/storageutil.py	Mon Nov 28 15:59:52 2022 +0100
+++ b/mercurial/utils/storageutil.py	Mon Nov 28 16:27:23 2022 +0100
@@ -430,28 +430,20 @@
         # There is a delta in storage. We try to use that because it
         # amounts to effectively copying data from storage and is
         # therefore the fastest.
-        elif deltaparentrev != nullrev:
-            # If the stored delta works, let us use it !
-            if is_usable_base(deltaparentrev):
-                baserev = deltaparentrev
-            # No guarantee the receiver has the delta parent. Send delta
-            # against last revision (if possible), which in the common case
-            # should be similar enough to this revision that the delta is
-            # reasonable.
-            elif prevrev is not None:
+        elif is_usable_base(deltaparentrev):
+            baserev = deltaparentrev
+        else:
+            # No guarantee the receiver has the delta parent, or Storage has a
+            # fulltext revision.
+            #
+            # Send delta against last revision (if possible), which in the
+            # common case should be similar enough to this revision that the
+            # delta is reasonable.
+            if prevrev is not None:
                 baserev = prevrev
             else:
                 baserev = nullrev
 
-        # Storage has a fulltext revision.
-
-        # Let's use the previous revision, which is as good a guess as any.
-        # There is definitely room to improve this logic.
-        elif prevrev is not None:
-            baserev = prevrev
-        else:
-            baserev = nullrev
-
         # But we can't actually use our chosen delta base for whatever
         # reason. Reset to fulltext.
         if baserev != nullrev and (candeltafn and not candeltafn(baserev, rev)):