[Request] [-- ] D12473: rust-dirstatemap: remove `set_dirstate_entry`/`set_entry` methods
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Wed Apr 6 14:13:21 UTC 2022
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
These methods were needed crutches before the Rust implementation caught up
to Python. Calling `set_entry` (whether from Python or Rust) was dangerous
since it didn't update any of the counters of the DirstateMap data structure,
while having no real way of knowing when to use it "correctly" except it you
were one of the 3 people who looked deep enough into the soul of this code.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D12473
AFFECTED FILES
rust/hg-core/src/dirstate_tree/dirstate_map.rs
rust/hg-cpython/src/dirstate/dirstate_map.rs
CHANGE DETAILS
diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -104,20 +104,6 @@
}
}
- def set_dirstate_item(
- &self,
- path: PyObject,
- item: DirstateItem
- ) -> PyResult<PyObject> {
- let f = path.extract::<PyBytes>(py)?;
- let filename = HgPath::new(f.data(py));
- self.inner(py)
- .borrow_mut()
- .set_entry(filename, item.get_entry(py))
- .map_err(|e| v2_error(py, e))?;
- Ok(py.None())
- }
-
def set_tracked(&self, f: PyObject) -> PyResult<PyBool> {
Ok(self.inner(py).borrow_mut()
.set_tracked(
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
@@ -878,17 +878,6 @@
});
}
- pub fn set_entry(
- &mut self,
- filename: &HgPath,
- entry: DirstateEntry,
- ) -> Result<(), DirstateV2ParseError> {
- self.with_dmap_mut(|map| {
- map.get_or_insert(&filename)?.data = NodeData::Entry(entry);
- Ok(())
- })
- }
-
pub fn set_tracked(
&mut self,
filename: &HgPath,
To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20220406/7fcf784a/attachment-0001.html>
More information about the Mercurial-patches
mailing list