Show More
@@ -53,21 +53,35 b" fn display_files<'a>(" | |||
|
53 | 53 | repo: &Repo, |
|
54 | 54 | files: impl IntoIterator<Item = &'a HgPath>, |
|
55 | 55 | ) -> Result<(), CommandError> { |
|
56 | let cwd = HgPathBuf::from(get_bytes_from_path(hg::utils::current_dir()?)); | |
|
56 | let mut stdout = ui.stdout_buffer(); | |
|
57 | ||
|
58 | let cwd = current_dir()?; | |
|
57 | 59 | let working_directory = repo.working_directory_path(); |
|
58 |
let working_directory = c |
|
|
60 | let working_directory = cwd.join(working_directory); // Make it absolute | |
|
61 | ||
|
62 | let mut any = false; | |
|
63 | if let Ok(cwd_relative_to_repo) = cwd.strip_prefix(&working_directory) { | |
|
64 | // The current directory is inside the repo, so we can work with | |
|
65 | // relative paths | |
|
66 | let cwd = HgPathBuf::from(get_bytes_from_path(cwd_relative_to_repo)); | |
|
67 | for file in files { | |
|
68 | any = true; | |
|
69 | stdout.write_all(relativize_path(&file, &cwd).as_ref())?; | |
|
70 | stdout.write_all(b"\n")?; | |
|
71 | } | |
|
72 | } else { | |
|
59 | 73 | let working_directory = |
|
60 | 74 | HgPathBuf::from(get_bytes_from_path(working_directory)); |
|
61 | ||
|
62 | let mut stdout = ui.stdout_buffer(); | |
|
63 | ||
|
64 | let mut any = false; | |
|
75 | let cwd = HgPathBuf::from(get_bytes_from_path(cwd)); | |
|
65 | 76 | for file in files { |
|
66 | 77 | any = true; |
|
78 | // Absolute path in the filesystem | |
|
67 | 79 | let file = working_directory.join(file); |
|
68 | 80 | stdout.write_all(relativize_path(&file, &cwd).as_ref())?; |
|
69 | 81 | stdout.write_all(b"\n")?; |
|
70 | 82 | } |
|
83 | } | |
|
84 | ||
|
71 | 85 | stdout.flush()?; |
|
72 | 86 | if any { |
|
73 | 87 | Ok(()) |
General Comments 0
You need to be logged in to leave comments.
Login now