diff -r f5b168979626 -r 95ffa065204e rust/rhg/src/commands/files.rs --- a/rust/rhg/src/commands/files.rs Wed Jan 11 17:27:19 2023 +0100 +++ b/rust/rhg/src/commands/files.rs Wed Jan 11 16:29:29 2023 +0100 @@ -4,9 +4,10 @@ use clap::Arg; use hg::errors::HgError; use hg::operations::list_rev_tracked_files; -use hg::operations::Dirstate; use hg::repo::Repo; +use hg::utils::filter_map_results; use hg::utils::hg_path::HgPath; +use rayon::prelude::*; pub const HELP_TEXT: &str = " List tracked files. @@ -70,8 +71,16 @@ "rhg files is not supported in narrow clones", )); } - let dirstate = Dirstate::new(repo)?; - let files = dirstate.tracked_files()?; + let dirstate = repo.dirstate_map()?; + let files_res: Result, _> = + filter_map_results(dirstate.iter(), |(path, entry)| { + Ok(if entry.tracked() { Some(path) } else { None }) + }) + .collect(); + + let mut files = files_res?; + files.par_sort_unstable(); + display_files(invocation.ui, repo, files.into_iter().map(Ok)) } }