manifest: use `read_any_fast_delta` during remotefilelog's repack
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 01 Aug 2024 05:36:53 +0200
changeset 51778 7e5ea2a0c3ef
parent 51777 87a8190e66fe
child 51779 82c6ea97dd64
manifest: use `read_any_fast_delta` during remotefilelog's repack We now have a better function with a clear semantic. This simplify the usage in the remotefilelog code.
hgext/remotefilelog/repack.py
--- a/hgext/remotefilelog/repack.py	Thu Aug 01 13:42:34 2024 +0200
+++ b/hgext/remotefilelog/repack.py	Thu Aug 01 05:36:53 2024 +0200
@@ -468,18 +468,14 @@
 
     # process the commits in toposorted order starting from the oldest
     for r in reversed(keep._list):
-        if repo[r].p1().rev() in processed:
-            # if the direct parent has already been processed
-            # then we only need to process the delta
-            m = repo[r].manifestctx().readdelta()
-        else:
-            # otherwise take the manifest and diff it
-            # with the previous manifest if one exists
+        delta_from, m = repo[r].manifestctx().read_any_fast_delta(processed)
+        if delta_from is None and lastmanifest is not None:
+            # could not find a delta, compute one.
+            # XXX (is this really faster?)
+            full = m
             if lastmanifest:
-                m = repo[r].manifest().diff(lastmanifest)
-            else:
-                m = repo[r].manifest()
-        lastmanifest = repo[r].manifest()
+                m = m.diff(lastmanifest)
+            lastmanifest = full
         processed.add(r)
 
         # populate keepkeys with keys from the current manifest