Let's use the new API.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | rust/hg-core/src/dirstate_tree/status.rs (32 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
d904391e8e94 | d535f43187e4 | Raphaël Gomès | Tue, Apr 12, 11:35 AM |
Status | Author | Revision | |
---|---|---|---|
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare |
use crate::dirstate::entry::TruncatedTimestamp; | use crate::dirstate::entry::TruncatedTimestamp; | ||||
use crate::dirstate::status::IgnoreFnType; | use crate::dirstate::status::IgnoreFnType; | ||||
use crate::dirstate::status::StatusPath; | use crate::dirstate::status::StatusPath; | ||||
use crate::dirstate_tree::dirstate_map::BorrowedPath; | use crate::dirstate_tree::dirstate_map::BorrowedPath; | ||||
use crate::dirstate_tree::dirstate_map::ChildNodesRef; | use crate::dirstate_tree::dirstate_map::ChildNodesRef; | ||||
use crate::dirstate_tree::dirstate_map::DirstateMap; | use crate::dirstate_tree::dirstate_map::DirstateMap; | ||||
use crate::dirstate_tree::dirstate_map::NodeRef; | use crate::dirstate_tree::dirstate_map::NodeRef; | ||||
use crate::dirstate_tree::on_disk::DirstateV2ParseError; | use crate::dirstate_tree::on_disk::DirstateV2ParseError; | ||||
use crate::matchers::get_ignore_function; | use crate::matchers::get_ignore_function; | ||||
use crate::matchers::Matcher; | use crate::matchers::Matcher; | ||||
use crate::utils::files::get_bytes_from_os_string; | use crate::utils::files::get_bytes_from_os_string; | ||||
use crate::utils::files::get_path_from_bytes; | use crate::utils::files::get_path_from_bytes; | ||||
use crate::utils::hg_path::HgPath; | use crate::utils::hg_path::HgPath; | ||||
use crate::BadMatch; | use crate::BadMatch; | ||||
use crate::DirstateStatus; | use crate::DirstateStatus; | ||||
use crate::EntryState; | |||||
use crate::HgPathBuf; | use crate::HgPathBuf; | ||||
use crate::HgPathCow; | use crate::HgPathCow; | ||||
use crate::PatternFileWarning; | use crate::PatternFileWarning; | ||||
use crate::StatusError; | use crate::StatusError; | ||||
use crate::StatusOptions; | use crate::StatusOptions; | ||||
use micro_timer::timed; | use micro_timer::timed; | ||||
use rayon::prelude::*; | use rayon::prelude::*; | ||||
use sha1::{Digest, Sha1}; | use sha1::{Digest, Sha1}; | ||||
)?; | )?; | ||||
self.maybe_save_directory_mtime( | self.maybe_save_directory_mtime( | ||||
children_all_have_dirstate_node_or_are_ignored, | children_all_have_dirstate_node_or_are_ignored, | ||||
fs_metadata, | fs_metadata, | ||||
dirstate_node, | dirstate_node, | ||||
)? | )? | ||||
} else { | } else { | ||||
if file_or_symlink && self.matcher.matches(hg_path) { | if file_or_symlink && self.matcher.matches(hg_path) { | ||||
if let Some(state) = dirstate_node.state()? { | if let Some(entry) = dirstate_node.entry()? { | ||||
match state { | if !entry.any_tracked() { | ||||
EntryState::Added => { | // Forward-compat if we start tracking unknown/ignored | ||||
self.push_outcome(Outcome::Added, &dirstate_node)? | // files for caching reasons | ||||
} | self.mark_unknown_or_ignored( | ||||
EntryState::Removed => self | has_ignored_ancestor, | ||||
.push_outcome(Outcome::Removed, &dirstate_node)?, | hg_path, | ||||
EntryState::Merged => self | ); | ||||
.push_outcome(Outcome::Modified, &dirstate_node)?, | } | ||||
EntryState::Normal => self | if entry.added() { | ||||
.handle_normal_file(&dirstate_node, fs_metadata)?, | self.push_outcome(Outcome::Added, &dirstate_node)?; | ||||
} else if entry.removed() { | |||||
self.push_outcome(Outcome::Removed, &dirstate_node)?; | |||||
} else if entry.modified() { | |||||
self.push_outcome(Outcome::Modified, &dirstate_node)?; | |||||
} else { | |||||
self.handle_normal_file(&dirstate_node, fs_metadata)?; | |||||
} | } | ||||
} else { | } else { | ||||
// `node.entry.is_none()` indicates a "directory" | // `node.entry.is_none()` indicates a "directory" | ||||
// node, but the filesystem has a file | // node, but the filesystem has a file | ||||
self.mark_unknown_or_ignored( | self.mark_unknown_or_ignored( | ||||
has_ignored_ancestor, | has_ignored_ancestor, | ||||
hg_path, | hg_path, | ||||
); | ); | ||||
self.new_cachable_directories | self.new_cachable_directories | ||||
.lock() | .lock() | ||||
.unwrap() | .unwrap() | ||||
.push((hg_path, directory_mtime)) | .push((hg_path, directory_mtime)) | ||||
} | } | ||||
Ok(()) | Ok(()) | ||||
} | } | ||||
/// A file with `EntryState::Normal` in the dirstate was found in the | /// A file that is clean in the dirstate was found in the filesystem | ||||
/// filesystem | |||||
fn handle_normal_file( | fn handle_normal_file( | ||||
&self, | &self, | ||||
dirstate_node: &NodeRef<'tree, 'on_disk>, | dirstate_node: &NodeRef<'tree, 'on_disk>, | ||||
fs_metadata: &std::fs::Metadata, | fs_metadata: &std::fs::Metadata, | ||||
) -> Result<(), DirstateV2ParseError> { | ) -> Result<(), DirstateV2ParseError> { | ||||
// Keep the low 31 bits | // Keep the low 31 bits | ||||
fn truncate_u64(value: u64) -> i32 { | fn truncate_u64(value: u64) -> i32 { | ||||
(value & 0x7FFF_FFFF) as i32 | (value & 0x7FFF_FFFF) as i32 |