diff --git a/rust/hg-core/src/dirstate/status.rs b/rust/hg-core/src/dirstate/status.rs --- a/rust/hg-core/src/dirstate/status.rs +++ b/rust/hg-core/src/dirstate/status.rs @@ -97,7 +97,8 @@ /// `Box` is syntactic sugar for `Box`, so add /// an explicit lifetime here to not fight `'static` bounds "out of nowhere". -type IgnoreFnType<'a> = Box Fn(&'r HgPath) -> bool + Sync + 'a>; +pub type IgnoreFnType<'a> = + Box Fn(&'r HgPath) -> bool + Sync + 'a>; /// We have a good mix of owned (from directory traversal) and borrowed (from /// the dirstate/explicit) paths, this comes up a lot. diff --git a/rust/hg-core/src/dirstate_tree.rs b/rust/hg-core/src/dirstate_tree.rs --- a/rust/hg-core/src/dirstate_tree.rs +++ b/rust/hg-core/src/dirstate_tree.rs @@ -1,3 +1,4 @@ pub mod dirstate_map; pub mod dispatch; pub mod path_with_basename; +mod status; 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 @@ -576,14 +576,14 @@ } fn status<'a>( - &'a self, - _matcher: &'a (dyn Matcher + Sync), - _root_dir: PathBuf, - _ignore_files: Vec, - _options: StatusOptions, + &'a mut self, + matcher: &'a (dyn Matcher + Sync), + root_dir: PathBuf, + ignore_files: Vec, + options: StatusOptions, ) -> Result<(DirstateStatus<'a>, Vec), StatusError> { - todo!() + super::status::status(self, matcher, root_dir, ignore_files, options) } fn copy_map_len(&self) -> usize { diff --git a/rust/hg-core/src/dirstate_tree/dispatch.rs b/rust/hg-core/src/dirstate_tree/dispatch.rs --- a/rust/hg-core/src/dirstate_tree/dispatch.rs +++ b/rust/hg-core/src/dirstate_tree/dispatch.rs @@ -96,7 +96,7 @@ fn set_dirs(&mut self) -> Result<(), DirstateMapError>; fn status<'a>( - &'a self, + &'a mut self, matcher: &'a (dyn Matcher + Sync), root_dir: PathBuf, ignore_files: Vec, @@ -258,7 +258,7 @@ } fn status<'a>( - &'a self, + &'a mut self, matcher: &'a (dyn Matcher + Sync), root_dir: PathBuf, ignore_files: Vec, diff --git a/rust/hg-core/src/dirstate_tree/status.rs b/rust/hg-core/src/dirstate_tree/status.rs new file mode 100644 --- /dev/null +++ b/rust/hg-core/src/dirstate_tree/status.rs @@ -0,0 +1,17 @@ +use crate::dirstate_tree::dirstate_map::DirstateMap; +use crate::matchers::Matcher; +use crate::DirstateStatus; +use crate::PatternFileWarning; +use crate::StatusError; +use crate::StatusOptions; +use std::path::PathBuf; + +pub fn status<'a>( + _dmap: &'a mut DirstateMap, + _matcher: &'a (dyn Matcher + Sync), + _root_dir: PathBuf, + _ignore_files: Vec, + _options: StatusOptions, +) -> Result<(DirstateStatus<'a>, Vec), StatusError> { + todo!() +} 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 @@ -8,7 +8,7 @@ //! Bindings for the `hg::dirstate::dirstate_map` file provided by the //! `hg-core` package. -use std::cell::{Ref, RefCell}; +use std::cell::{RefCell, RefMut}; use std::convert::TryInto; use cpython::{ @@ -527,11 +527,11 @@ }); impl DirstateMap { - pub fn get_inner<'a>( + pub fn get_inner_mut<'a>( &'a self, py: Python<'a>, - ) -> Ref<'a, Box> { - self.inner(py).borrow() + ) -> RefMut<'a, Box> { + self.inner(py).borrow_mut() } fn translate_key( py: Python, diff --git a/rust/hg-cpython/src/dirstate/status.rs b/rust/hg-cpython/src/dirstate/status.rs --- a/rust/hg-cpython/src/dirstate/status.rs +++ b/rust/hg-cpython/src/dirstate/status.rs @@ -112,7 +112,7 @@ let root_dir = get_path_from_bytes(bytes.data(py)); let dmap: DirstateMap = dmap.to_py_object(py); - let dmap = dmap.get_inner(py); + let mut dmap = dmap.get_inner_mut(py); let ignore_files: PyResult> = ignore_files .iter(py)