# HG changeset patch # User Raphaël Gomès # Date 2020-05-12 10:41:28 # Node ID dc60ba32d43b19938c952dec6942a1ece03068e9 # Parent 63edfea7dfdeeb4c771060b74fae39a4f350dee5 rust-status: don't dispatch unknown file when traversing if not listing unknowns This usually isn't a (functional) problem since we ignore the unknown files anyway, but when specifically using `hg purge`, unknown files were iterated over regardless of the option being true. This is both more correct and more efficient. Differential Revision: https://phab.mercurial-scm.org/D8517 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 @@ -371,9 +371,11 @@ fn handle_traversed_entry<'a>( .unwrap(); } } else { - files_sender - .send(Ok((filename.to_owned(), Dispatch::Unknown))) - .unwrap(); + if options.list_unknown { + files_sender + .send(Ok((filename.to_owned(), Dispatch::Unknown))) + .unwrap(); + } } } else if ignore_fn(&filename) && options.list_ignored { files_sender