comparison rust/rhg/src/commands/files.rs @ 46740:97ac588b6d9e

rhg: Don?t make repository path absolute too early Some error messages want to include a relative path, which affects the output of some tests. Differential Revision: https://phab.mercurial-scm.org/D10138
author Simon Sapin <simon.sapin@octobus.net>
date Mon, 08 Mar 2021 08:35:43 +0100
parents c184b490da37
children 63bfcddddac1
comparison
equal deleted inserted replaced
46739:c184b490da37 46740:97ac588b6d9e
2 use crate::ui::Ui; 2 use crate::ui::Ui;
3 use clap::Arg; 3 use clap::Arg;
4 use hg::operations::list_rev_tracked_files; 4 use hg::operations::list_rev_tracked_files;
5 use hg::operations::Dirstate; 5 use hg::operations::Dirstate;
6 use hg::repo::Repo; 6 use hg::repo::Repo;
7 use hg::utils::current_dir;
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};
9 10
10 pub const HELP_TEXT: &str = " 11 pub const HELP_TEXT: &str = "
11 List tracked files. 12 List tracked files.
51 ui: &Ui, 52 ui: &Ui,
52 repo: &Repo, 53 repo: &Repo,
53 files: impl IntoIterator<Item = &'a HgPath>, 54 files: impl IntoIterator<Item = &'a HgPath>,
54 ) -> Result<(), CommandError> { 55 ) -> Result<(), CommandError> {
55 let cwd = HgPathBuf::from(get_bytes_from_path(hg::utils::current_dir()?)); 56 let cwd = HgPathBuf::from(get_bytes_from_path(hg::utils::current_dir()?));
57 let working_directory = repo.working_directory_path();
58 let working_directory = current_dir()?.join(working_directory); // Make it absolute
56 let working_directory = 59 let working_directory =
57 HgPathBuf::from(get_bytes_from_path(repo.working_directory_path())); 60 HgPathBuf::from(get_bytes_from_path(working_directory));
58 61
59 let mut stdout = ui.stdout_buffer(); 62 let mut stdout = ui.stdout_buffer();
60 63
61 for file in files { 64 for file in files {
62 let file = working_directory.join(file); 65 let file = working_directory.join(file);