[Request] [+- ] D12540: rust-status: stop using `state()` in the dispatch logic
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Tue Apr 12 16:07:18 UTC 2022
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
Let's use the new API.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D12540
AFFECTED FILES
rust/hg-core/src/dirstate_tree/status.rs
CHANGE DETAILS
diff --git a/rust/hg-core/src/dirstate_tree/status.rs b/rust/hg-core/src/dirstate_tree/status.rs
--- a/rust/hg-core/src/dirstate_tree/status.rs
+++ b/rust/hg-core/src/dirstate_tree/status.rs
@@ -13,7 +13,6 @@
use crate::utils::hg_path::HgPath;
use crate::BadMatch;
use crate::DirstateStatus;
-use crate::EntryState;
use crate::HgPathBuf;
use crate::HgPathCow;
use crate::PatternFileWarning;
@@ -459,17 +458,23 @@
)?
} else {
if file_or_symlink && self.matcher.matches(hg_path) {
- if let Some(state) = dirstate_node.state()? {
- match state {
- EntryState::Added => {
- self.push_outcome(Outcome::Added, &dirstate_node)?
- }
- EntryState::Removed => self
- .push_outcome(Outcome::Removed, &dirstate_node)?,
- EntryState::Merged => self
- .push_outcome(Outcome::Modified, &dirstate_node)?,
- EntryState::Normal => self
- .handle_normal_file(&dirstate_node, fs_metadata)?,
+ if let Some(entry) = dirstate_node.entry()? {
+ if !entry.any_tracked() {
+ // Forward-compat if we start tracking unknown/ignored
+ // files for caching reasons
+ self.mark_unknown_or_ignored(
+ has_ignored_ancestor,
+ hg_path,
+ );
+ }
+ if entry.added() {
+ 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 {
// `node.entry.is_none()` indicates a "directory"
@@ -579,8 +584,7 @@
Ok(())
}
- /// A file with `EntryState::Normal` in the dirstate was found in the
- /// filesystem
+ /// A file that is clean in the dirstate was found in the filesystem
fn handle_normal_file(
&self,
dirstate_node: &NodeRef<'tree, 'on_disk>,
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/20220412/41e66afc/attachment-0001.html>
More information about the Mercurial-patches
mailing list