changeset 48258:c591944f42c1

dirstate: align Rust function name to `need_delay` The rest of the code use this name. It is not a great name, but it is better to stay consistent. Differential Revision: https://phab.mercurial-scm.org/D11699
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 19 Oct 2021 22:14:48 +0200
parents f45d35950db6
children 84f6b0c41b90
files rust/hg-core/src/dirstate/entry.rs rust/hg-core/src/dirstate_tree/dirstate_map.rs rust/hg-cpython/src/dirstate/item.rs
diffstat 3 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/entry.rs	Mon Oct 18 19:02:40 2021 +0200
+++ b/rust/hg-core/src/dirstate/entry.rs	Tue Oct 19 22:14:48 2021 +0200
@@ -576,12 +576,13 @@
         (self.state().into(), self.mode(), self.size(), self.mtime())
     }
 
-    pub fn mtime_is_ambiguous(&self, now: i32) -> bool {
+    /// True if the stored mtime would be ambiguous with the current time
+    pub fn need_delay(&self, now: i32) -> bool {
         self.state() == EntryState::Normal && self.mtime() == now
     }
 
     pub fn clear_ambiguous_mtime(&mut self, now: i32) -> bool {
-        let ambiguous = self.mtime_is_ambiguous(now);
+        let ambiguous = self.need_delay(now);
         if ambiguous {
             // The file was last modified "simultaneously" with the current
             // write to dirstate (i.e. within the same second for file-
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Mon Oct 18 19:02:40 2021 +0200
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Tue Oct 19 22:14:48 2021 +0200
@@ -947,7 +947,7 @@
                     node.full_path(map.on_disk)?,
                     node.copy_source(map.on_disk)?,
                 );
-                if entry.mtime_is_ambiguous(now) {
+                if entry.need_delay(now) {
                     ambiguous_mtimes.push(
                         node.full_path_borrowed(map.on_disk)?
                             .detach_from_tree(),
@@ -991,7 +991,7 @@
         for node in map.iter_nodes() {
             let node = node?;
             if let Some(entry) = node.entry()? {
-                if entry.mtime_is_ambiguous(now) {
+                if entry.need_delay(now) {
                     paths.push(
                         node.full_path_borrowed(map.on_disk)?
                             .detach_from_tree(),
--- a/rust/hg-cpython/src/dirstate/item.rs	Mon Oct 18 19:02:40 2021 +0200
+++ b/rust/hg-cpython/src/dirstate/item.rs	Tue Oct 19 22:14:48 2021 +0200
@@ -192,7 +192,7 @@
     }
 
     def need_delay(&self, now: i32) -> PyResult<bool> {
-        Ok(self.entry(py).get().mtime_is_ambiguous(now))
+        Ok(self.entry(py).get().need_delay(now))
     }
 
     @classmethod