diff rust/hg-core/src/revlog/inner_revlog.rs @ 52185:8d35941689af

rust-vfs: support checkambig This was missing from the Rust code, which means worse caching. See https://wiki.mercurial-scm.org/ExactCacheValidationPlan. Explanations on what ambiguity means inline.
author Raphaël Gomès <rgomes@octobus.net>
date Thu, 10 Oct 2024 15:54:45 +0200
parents e01e84e5e426
children a3fa37bdb7ec
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/inner_revlog.rs	Tue Oct 08 16:10:30 2024 +0200
+++ b/rust/hg-core/src/revlog/inner_revlog.rs	Thu Oct 10 15:54:45 2024 +0200
@@ -857,7 +857,7 @@
                         if error.kind() != ErrorKind::NotFound {
                             return Err(HgError::IoError { error, context });
                         }
-                        self.vfs.create(&self.data_file)?
+                        self.vfs.create(&self.data_file, true)?
                     }
                     e => return Err(e),
                 },
@@ -964,7 +964,8 @@
             self.writing_handles.take();
             self.segment_file.writing_handle.take();
         }
-        let mut new_data_file_handle = self.vfs.create(&self.data_file)?;
+        let mut new_data_file_handle =
+            self.vfs.create(&self.data_file, true)?;
         // Drop any potential data, possibly redundant with the VFS impl.
         new_data_file_handle
             .set_len(0)
@@ -988,7 +989,7 @@
             self.index_file = index_path
         }
 
-        let mut new_index_handle = self.vfs.create(&self.index_file)?;
+        let mut new_index_handle = self.vfs.create(&self.index_file, true)?;
         let mut new_data = Vec::with_capacity(self.len() * INDEX_ENTRY_SIZE);
         for r in 0..self.len() {
             let rev = Revision(r as BaseRevision);