diff rust/hg-core/src/revlog/index.rs @ 51256:456e0fe702e8

rust-index: honour incoming using_general_delta in `deltachain` It looks to be a leftover from some past, but the C index considers only the value passed from Python whereas up to now the Rust index was using the value of its attribute. As a middle ground, we make this argument of `deltachain` optional from the Python side, with the Rust implementation only defaulting to its attribute. This way, we reduce false leads when a difference in results is spotted.
author Georges Racinet on incendie.racinet.fr <georges@racinet.fr>
date Fri, 27 Oct 2023 23:21:50 +0200
parents 59183a19954e
children eb676c35a29b
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/index.rs	Fri Oct 27 21:48:45 2023 +0200
+++ b/rust/hg-core/src/revlog/index.rs	Fri Oct 27 23:21:50 2023 +0200
@@ -599,15 +599,18 @@
         &self,
         rev: Revision,
         stop_rev: Option<Revision>,
+        using_general_delta: Option<bool>,
     ) -> Result<(Vec<Revision>, bool), HgError> {
         let mut current_rev = rev;
         let mut entry = self.get_entry(rev).unwrap();
         let mut chain = vec![];
+        let using_general_delta =
+            using_general_delta.unwrap_or_else(|| self.uses_generaldelta());
         while current_rev.0 != entry.base_revision_or_base_of_delta_chain().0
             && stop_rev.map(|r| r != current_rev).unwrap_or(true)
         {
             chain.push(current_rev);
-            let new_rev = if self.uses_generaldelta() {
+            let new_rev = if using_general_delta {
                 entry.base_revision_or_base_of_delta_chain()
             } else {
                 UncheckedRevision(current_rev.0 - 1)