Mercurial > hg
changeset 50863:264072107105
rust-status: error on non-existent files in file_set
file_set here consists of the files that were explicitly specified on
the command line. Erroring on them matches the behavior of Python
status.
author | Spencer Baugh <sbaugh@janestreet.com> |
---|---|
date | Wed, 02 Aug 2023 10:21:18 -0400 |
parents | 5efccea9cf38 |
children | 76387f79befe |
files | rust/hg-core/src/dirstate_tree/dirstate_map.rs rust/hg-core/src/dirstate_tree/status.rs |
diffstat | 2 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Wed Aug 02 10:07:00 2023 -0400 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Wed Aug 02 10:21:18 2023 -0400 @@ -579,6 +579,14 @@ } } + pub fn has_node( + &self, + path: &HgPath, + ) -> Result<bool, DirstateV2ParseError> { + let node = self.get_node(path)?; + Ok(node.is_some()) + } + /// Returns a mutable reference to the node at `path` if it exists /// /// `each_ancestor` is a callback that is called for each ancestor node
--- a/rust/hg-core/src/dirstate_tree/status.rs Wed Aug 02 10:07:00 2023 -0400 +++ b/rust/hg-core/src/dirstate_tree/status.rs Wed Aug 02 10:21:18 2023 -0400 @@ -12,6 +12,7 @@ use crate::utils::files::get_bytes_from_os_string; use crate::utils::files::get_bytes_from_path; use crate::utils::files::get_path_from_bytes; +use crate::utils::hg_path::hg_path_to_path_buf; use crate::utils::hg_path::HgPath; use crate::BadMatch; use crate::BadType; @@ -157,6 +158,18 @@ root_cached_mtime, is_at_repo_root, )?; + if let Some(file_set) = common.matcher.file_set() { + for file in file_set { + if !file.is_empty() && !dmap.has_node(file)? { + let path = hg_path_to_path_buf(file)?; + if let io::Result::Err(error) = + root_dir.join(path).symlink_metadata() + { + common.io_error(error, file) + } + } + } + } let mut outcome = common.outcome.into_inner().unwrap(); let new_cacheable = common.new_cacheable_directories.into_inner().unwrap(); let outdated = common.outdated_cached_directories.into_inner().unwrap();