changeset 48056:cd13d3c2ad2e

dirstate: drop the `clearambiguoustimes` method for the map This is no longer called anywhere. Differential Revision: https://phab.mercurial-scm.org/D11502
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 22 Sep 2021 15:23:03 +0200
parents 84e7a86e3a63
children 62188e4de549
files mercurial/dirstatemap.py rust/hg-core/src/dirstate/dirstate_map.rs rust/hg-core/src/dirstate_tree/dirstate_map.rs rust/hg-core/src/dirstate_tree/dispatch.rs rust/hg-core/src/dirstate_tree/owning_dispatch.rs rust/hg-cpython/src/dirstate/dirstate_map.rs
diffstat 6 files changed, 9 insertions(+), 102 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstatemap.py	Wed Sep 22 14:54:42 2021 +0200
+++ b/mercurial/dirstatemap.py	Wed Sep 22 15:23:03 2021 +0200
@@ -330,13 +330,6 @@
                 entry.set_untracked()
             return True
 
-    def clearambiguoustimes(self, files, now):
-        for f in files:
-            e = self.get(f)
-            if e is not None and e.need_delay(now):
-                e.set_possibly_dirty()
-                self.nonnormalset.add(f)
-
     def nonnormalentries(self):
         '''Compute the nonnormal dirstate entries from the dmap'''
         try:
@@ -701,9 +694,6 @@
         def removefile(self, *args, **kwargs):
             return self._rustmap.removefile(*args, **kwargs)
 
-        def clearambiguoustimes(self, *args, **kwargs):
-            return self._rustmap.clearambiguoustimes(*args, **kwargs)
-
         def nonnormalentries(self):
             return self._rustmap.nonnormalentries()
 
--- a/rust/hg-core/src/dirstate/dirstate_map.rs	Wed Sep 22 14:54:42 2021 +0200
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs	Wed Sep 22 15:23:03 2021 +0200
@@ -182,22 +182,6 @@
         Ok(())
     }
 
-    pub fn clear_ambiguous_times(
-        &mut self,
-        filenames: Vec<HgPathBuf>,
-        now: i32,
-    ) {
-        for filename in filenames {
-            if let Some(entry) = self.state_map.get_mut(&filename) {
-                if entry.clear_ambiguous_mtime(now) {
-                    self.get_non_normal_other_parent_entries()
-                        .0
-                        .insert(filename.to_owned());
-                }
-            }
-        }
-    }
-
     pub fn non_normal_entries_remove(
         &mut self,
         key: impl AsRef<HgPath>,
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Wed Sep 22 14:54:42 2021 +0200
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Wed Sep 22 15:23:03 2021 +0200
@@ -917,26 +917,6 @@
         Ok(())
     }
 
-    fn clear_ambiguous_times(
-        &mut self,
-        filenames: Vec<HgPathBuf>,
-        now: i32,
-    ) -> Result<(), DirstateV2ParseError> {
-        for filename in filenames {
-            if let Some(node) = Self::get_node_mut(
-                self.on_disk,
-                &mut self.unreachable_bytes,
-                &mut self.root,
-                &filename,
-            )? {
-                if let NodeData::Entry(entry) = &mut node.data {
-                    entry.clear_ambiguous_mtime(now);
-                }
-            }
-        }
-        Ok(())
-    }
-
     fn non_normal_entries_contains(
         &mut self,
         key: &HgPath,
--- a/rust/hg-core/src/dirstate_tree/dispatch.rs	Wed Sep 22 14:54:42 2021 +0200
+++ b/rust/hg-core/src/dirstate_tree/dispatch.rs	Wed Sep 22 15:23:03 2021 +0200
@@ -67,15 +67,6 @@
         filename: &HgPath,
     ) -> Result<(), DirstateError>;
 
-    /// Among given files, mark the stored `mtime` as ambiguous if there is one
-    /// (if `state == EntryState::Normal`) equal to the given current Unix
-    /// timestamp.
-    fn clear_ambiguous_times(
-        &mut self,
-        filenames: Vec<HgPathBuf>,
-        now: i32,
-    ) -> Result<(), DirstateV2ParseError>;
-
     /// Return whether the map has an "non-normal" entry for the given
     /// filename. That is, any entry with a `state` other than
     /// `EntryState::Normal` or with an ambiguous `mtime`.
@@ -165,20 +156,18 @@
     /// file with a dirstate entry.
     fn has_dir(&mut self, directory: &HgPath) -> Result<bool, DirstateError>;
 
-    /// Clear mtimes that are ambigous with `now` (similar to
-    /// `clear_ambiguous_times` but for all files in the dirstate map), and
-    /// serialize bytes to write the `.hg/dirstate` file to disk in dirstate-v1
-    /// format.
+    /// Clear mtimes equal to `now` in entries with `state ==
+    /// EntryState::Normal`, and serialize bytes to write the `.hg/dirstate`
+    /// file to disk in dirstate-v1 format.
     fn pack_v1(
         &mut self,
         parents: DirstateParents,
         now: Timestamp,
     ) -> Result<Vec<u8>, DirstateError>;
 
-    /// Clear mtimes that are ambigous with `now` (similar to
-    /// `clear_ambiguous_times` but for all files in the dirstate map), and
-    /// serialize bytes to write a dirstate data file to disk in dirstate-v2
-    /// format.
+    /// Clear mtimes equal to `now` in entries with `state ==
+    /// EntryState::Normal`, and serialize  bytes to write a dirstate data file
+    /// to disk in dirstate-v2 format.
     ///
     /// Returns new data and metadata together with whether that data should be
     /// appended to the existing data file whose content is at
@@ -341,14 +330,6 @@
         self.drop_entry_and_copy_source(filename)
     }
 
-    fn clear_ambiguous_times(
-        &mut self,
-        filenames: Vec<HgPathBuf>,
-        now: i32,
-    ) -> Result<(), DirstateV2ParseError> {
-        Ok(self.clear_ambiguous_times(filenames, now))
-    }
-
     fn non_normal_entries_contains(
         &mut self,
         key: &HgPath,
--- a/rust/hg-core/src/dirstate_tree/owning_dispatch.rs	Wed Sep 22 14:54:42 2021 +0200
+++ b/rust/hg-core/src/dirstate_tree/owning_dispatch.rs	Wed Sep 22 15:23:03 2021 +0200
@@ -51,14 +51,6 @@
         self.get_mut().drop_entry_and_copy_source(filename)
     }
 
-    fn clear_ambiguous_times(
-        &mut self,
-        filenames: Vec<HgPathBuf>,
-        now: i32,
-    ) -> Result<(), DirstateV2ParseError> {
-        self.get_mut().clear_ambiguous_times(filenames, now)
-    }
-
     fn non_normal_entries_contains(
         &mut self,
         key: &HgPath,
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs	Wed Sep 22 14:54:42 2021 +0200
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs	Wed Sep 22 15:23:03 2021 +0200
@@ -12,9 +12,9 @@
 use std::convert::TryInto;
 
 use cpython::{
-    exc, ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyList,
-    PyNone, PyObject, PyResult, PySet, PyString, Python, PythonObject,
-    ToPyObject, UnsafePyLeaked,
+    exc, PyBool, PyBytes, PyClone, PyDict, PyErr, PyList, PyNone, PyObject,
+    PyResult, PySet, PyString, Python, PythonObject, ToPyObject,
+    UnsafePyLeaked,
 };
 
 use crate::{
@@ -185,26 +185,6 @@
         Ok(PyNone)
     }
 
-    def clearambiguoustimes(
-        &self,
-        files: PyObject,
-        now: PyObject
-    ) -> PyResult<PyObject> {
-        let files: PyResult<Vec<HgPathBuf>> = files
-            .iter(py)?
-            .map(|filename| {
-                Ok(HgPathBuf::from_bytes(
-                    filename?.extract::<PyBytes>(py)?.data(py),
-                ))
-            })
-            .collect();
-        self.inner(py)
-            .borrow_mut()
-            .clear_ambiguous_times(files?, now.extract(py)?)
-            .map_err(|e| v2_error(py, e))?;
-        Ok(py.None())
-    }
-
     def other_parent_entries(&self) -> PyResult<PyObject> {
         let mut inner_shared = self.inner(py).borrow_mut();
         let set = PySet::empty(py)?;