comparison rust/rhg/src/commands/files.rs @ 46484:a6e4e4650bac

rhg: Parse system and user configuration at program start ? and pass it around up to `Repo::find` Differential Revision: https://phab.mercurial-scm.org/D9962
author Simon Sapin <simon.sapin@octobus.net>
date Thu, 04 Feb 2021 13:17:55 +0100
parents 1dcd9c9975ed
children 184e46550dc8
comparison
equal deleted inserted replaced
46483:2845892dd489 46484:a6e4e4650bac
1 use crate::commands::Command; 1 use crate::commands::Command;
2 use crate::error::CommandError; 2 use crate::error::CommandError;
3 use crate::ui::Ui; 3 use crate::ui::Ui;
4 use hg::config::Config;
4 use hg::operations::list_rev_tracked_files; 5 use hg::operations::list_rev_tracked_files;
5 use hg::operations::Dirstate; 6 use hg::operations::Dirstate;
6 use hg::repo::Repo; 7 use hg::repo::Repo;
7 use hg::utils::files::{get_bytes_from_path, relativize_path}; 8 use hg::utils::files::{get_bytes_from_path, relativize_path};
8 use hg::utils::hg_path::{HgPath, HgPathBuf}; 9 use hg::utils::hg_path::{HgPath, HgPathBuf};
44 Ok(()) 45 Ok(())
45 } 46 }
46 } 47 }
47 48
48 impl<'a> Command for FilesCommand<'a> { 49 impl<'a> Command for FilesCommand<'a> {
49 fn run(&self, ui: &Ui) -> Result<(), CommandError> { 50 fn run(&self, ui: &Ui, config: &Config) -> Result<(), CommandError> {
50 let repo = Repo::find()?; 51 let repo = Repo::find(config)?;
51 if let Some(rev) = self.rev { 52 if let Some(rev) = self.rev {
52 let files = 53 let files =
53 list_rev_tracked_files(&repo, rev).map_err(|e| (e, rev))?; 54 list_rev_tracked_files(&repo, rev).map_err(|e| (e, rev))?;
54 self.display_files(ui, &repo, files.iter()) 55 self.display_files(ui, &repo, files.iter())
55 } else { 56 } else {