Patchwork D11699: dirstate: align Rust function name to `need_delay`

login
register
mail settings
Submitter phabricator
Date Oct. 19, 2021, 10:04 p.m.
Message ID <differential-rev-PHID-DREV-l6wzynz56fbyohun3fie-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50023/
State Superseded
Headers show

Comments

phabricator - Oct. 19, 2021, 10:04 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The rest of the code use this name. It is not a great name, but it is better to
  stay consistent.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11699

AFFECTED FILES
  rust/hg-core/src/dirstate/entry.rs
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-cpython/src/dirstate/item.rs

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-cpython/src/dirstate/item.rs b/rust/hg-cpython/src/dirstate/item.rs
--- a/rust/hg-cpython/src/dirstate/item.rs
+++ b/rust/hg-cpython/src/dirstate/item.rs
@@ -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
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -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(),
diff --git a/rust/hg-core/src/dirstate/entry.rs b/rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs
+++ b/rust/hg-core/src/dirstate/entry.rs
@@ -576,12 +576,12 @@ 
         (self.state().into(), self.mode(), self.size(), self.mtime())
     }
 
-    pub fn mtime_is_ambiguous(&self, now: i32) -> bool {
+    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-