# HG changeset patch # User Spencer Baugh # Date 1690986078 14400 # Node ID 26407210710544ff7f14ac6135369fd249265578 # Parent 5efccea9cf38aaaff5810bdc86e07ea35e318c03 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. diff -r 5efccea9cf38 -r 264072107105 rust/hg-core/src/dirstate_tree/dirstate_map.rs --- 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 { + 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 diff -r 5efccea9cf38 -r 264072107105 rust/hg-core/src/dirstate_tree/status.rs --- 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();