rust/rhg/src/commands/files.rs
changeset 50039 795b5b01cbd2
parent 50036 95ffa065204e
child 50040 df9eabc9837b
equal deleted inserted replaced
50038:7faedeb24eb2 50039:795b5b01cbd2
     1 use crate::error::CommandError;
     1 use crate::error::CommandError;
     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;
       
     6 use hg::operations::list_rev_tracked_files;
     5 use hg::operations::list_rev_tracked_files;
     7 use hg::repo::Repo;
     6 use hg::repo::Repo;
     8 use hg::utils::filter_map_results;
     7 use hg::utils::filter_map_results;
     9 use hg::utils::hg_path::HgPath;
     8 use hg::utils::hg_path::HgPath;
    10 use rayon::prelude::*;
     9 use rayon::prelude::*;
    83 
    82 
    84         display_files(invocation.ui, repo, files.into_iter().map(Ok))
    83         display_files(invocation.ui, repo, files.into_iter().map(Ok))
    85     }
    84     }
    86 }
    85 }
    87 
    86 
    88 fn display_files<'a>(
    87 fn display_files<'a, E>(
    89     ui: &Ui,
    88     ui: &Ui,
    90     repo: &Repo,
    89     repo: &Repo,
    91     files: impl IntoIterator<Item = Result<&'a HgPath, HgError>>,
    90     files: impl IntoIterator<Item = Result<&'a HgPath, E>>,
    92 ) -> Result<(), CommandError> {
    91 ) -> Result<(), CommandError>
       
    92 where
       
    93     CommandError: From<E>,
       
    94 {
    93     let mut stdout = ui.stdout_buffer();
    95     let mut stdout = ui.stdout_buffer();
    94     let mut any = false;
    96     let mut any = false;
    95 
    97 
    96     let relativize = RelativizePaths::new(repo)?;
    98     let relativize = RelativizePaths::new(repo)?;
    97     for result in files {
    99     for result in files {