equal
deleted
inserted
replaced
2 use crate::ui::Ui; |
2 use crate::ui::Ui; |
3 use crate::utils::path_utils::RelativizePaths; |
3 use crate::utils::path_utils::RelativizePaths; |
4 use clap::Arg; |
4 use clap::Arg; |
5 use hg::errors::HgError; |
5 use hg::errors::HgError; |
6 use hg::operations::list_rev_tracked_files; |
6 use hg::operations::list_rev_tracked_files; |
7 use hg::operations::Dirstate; |
|
8 use hg::repo::Repo; |
7 use hg::repo::Repo; |
|
8 use hg::utils::filter_map_results; |
9 use hg::utils::hg_path::HgPath; |
9 use hg::utils::hg_path::HgPath; |
|
10 use rayon::prelude::*; |
10 |
11 |
11 pub const HELP_TEXT: &str = " |
12 pub const HELP_TEXT: &str = " |
12 List tracked files. |
13 List tracked files. |
13 |
14 |
14 Returns 0 on success. |
15 Returns 0 on success. |
68 if repo.has_narrow() { |
69 if repo.has_narrow() { |
69 return Err(CommandError::unsupported( |
70 return Err(CommandError::unsupported( |
70 "rhg files is not supported in narrow clones", |
71 "rhg files is not supported in narrow clones", |
71 )); |
72 )); |
72 } |
73 } |
73 let dirstate = Dirstate::new(repo)?; |
74 let dirstate = repo.dirstate_map()?; |
74 let files = dirstate.tracked_files()?; |
75 let files_res: Result<Vec<_>, _> = |
|
76 filter_map_results(dirstate.iter(), |(path, entry)| { |
|
77 Ok(if entry.tracked() { Some(path) } else { None }) |
|
78 }) |
|
79 .collect(); |
|
80 |
|
81 let mut files = files_res?; |
|
82 files.par_sort_unstable(); |
|
83 |
75 display_files(invocation.ui, repo, files.into_iter().map(Ok)) |
84 display_files(invocation.ui, repo, files.into_iter().map(Ok)) |
76 } |
85 } |
77 } |
86 } |
78 |
87 |
79 fn display_files<'a>( |
88 fn display_files<'a>( |