changeset 50976:9929c8a73488

rust-revlog: split logic for `rawdata` to prepare for `UncheckedRevision` use In the next changeset, we will change the logic to use `UncheckedRevision` in the non-general delta case. The general delta case will use the "checked" path since `base_rev_or_base_of_delta_chain` will be checked.
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 11 Sep 2023 11:52:33 +0200
parents 3aca98a35727
children 1928b770e3e7
files rust/hg-core/src/revlog/mod.rs
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/mod.rs	Mon Aug 07 15:07:48 2023 +0200
+++ b/rust/hg-core/src/revlog/mod.rs	Mon Sep 11 11:52:33 2023 +0200
@@ -537,13 +537,14 @@
         // [_chaininfo] and in [index_deltachain].
         let uses_generaldelta = self.revlog.index.uses_generaldelta();
         while let Some(base_rev) = entry.base_rev_or_base_of_delta_chain {
-            let base_rev = if uses_generaldelta {
-                base_rev
+            entry = if uses_generaldelta {
+                delta_chain.push(entry);
+                self.revlog.get_entry_internal(base_rev)?
             } else {
-                entry.rev - 1
+                let base_rev = entry.rev - 1;
+                delta_chain.push(entry);
+                self.revlog.get_entry_internal(base_rev)?
             };
-            delta_chain.push(entry);
-            entry = self.revlog.get_entry_internal(base_rev)?;
         }
 
         let data = if delta_chain.is_empty() {