changeset 49667:191f5057ec45

emitrevision: add a small closure to check if a base is usable We will make more use of this and make it more complex too.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 28 Nov 2022 15:48:51 +0100
parents 4bd12c0f531e
children 383c79f8e5a7
files mercurial/utils/storageutil.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/storageutil.py	Mon Oct 17 16:26:16 2022 +0200
+++ b/mercurial/utils/storageutil.py	Mon Nov 28 15:48:51 2022 +0100
@@ -396,6 +396,9 @@
     # Set of revs available to delta against.
     available = set()
 
+    def is_usable_base(rev):
+        return rev != nullrev and rev in available
+
     for rev in revs:
         if rev == nullrev:
             continue
@@ -445,7 +448,7 @@
         elif deltaparentrev != nullrev:
             # Base revision was already emitted in this group. We can
             # always safely use the delta.
-            if deltaparentrev in available:
+            if is_usable_base(deltaparentrev):
                 if debug_info is not None:
                     debug_delta_source = "storage"
                 baserev = deltaparentrev