rust/rhg/src/commands/files.rs
changeset 46632 5ce2aa7c2ad5
parent 46631 80840b651721
child 46752 c184b490da37
equal deleted inserted replaced
46631:80840b651721 46632:5ce2aa7c2ad5
    27 }
    27 }
    28 
    28 
    29 pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
    29 pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
    30     let rev = invocation.subcommand_args.value_of("rev");
    30     let rev = invocation.subcommand_args.value_of("rev");
    31 
    31 
    32     let repo = Repo::find(invocation.non_repo_config, invocation.repo_path)?;
    32     let repo = invocation.repo?;
    33     if let Some(rev) = rev {
    33     if let Some(rev) = rev {
    34         let files =
    34         let files = list_rev_tracked_files(repo, rev).map_err(|e| (e, rev))?;
    35             list_rev_tracked_files(&repo, rev).map_err(|e| (e, rev))?;
    35         display_files(invocation.ui, repo, files.iter())
    36         display_files(invocation.ui, &repo, files.iter())
       
    37     } else {
    36     } else {
    38         let distate = Dirstate::new(&repo)?;
    37         let distate = Dirstate::new(repo)?;
    39         let files = distate.tracked_files()?;
    38         let files = distate.tracked_files()?;
    40         display_files(invocation.ui, &repo, files)
    39         display_files(invocation.ui, repo, files)
    41     }
    40     }
    42 }
    41 }
    43 
    42 
    44 fn display_files<'a>(
    43 fn display_files<'a>(
    45     ui: &Ui,
    44     ui: &Ui,