Mercurial > public > mercurial-scm > hg
comparison rust/rhg/src/commands/files.rs @ 46445:ca3f73cc3cf4
rhg: Simplify CommandError based on its use
Differential Revision: https://phab.mercurial-scm.org/D9905
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Thu, 28 Jan 2021 19:13:55 +0100 |
parents | 252d1bdba33d |
children | 1dcd9c9975ed |
comparison
equal
deleted
inserted
replaced
46444:6c778d20c8c2 | 46445:ca3f73cc3cf4 |
---|---|
26 &self, | 26 &self, |
27 ui: &Ui, | 27 ui: &Ui, |
28 repo: &Repo, | 28 repo: &Repo, |
29 files: impl IntoIterator<Item = &'a HgPath>, | 29 files: impl IntoIterator<Item = &'a HgPath>, |
30 ) -> Result<(), CommandError> { | 30 ) -> Result<(), CommandError> { |
31 let cwd = std::env::current_dir() | 31 let cwd = hg::utils::current_dir()?; |
32 .or_else(|e| Err(CommandError::CurrentDirNotFound(e)))?; | |
33 let rooted_cwd = cwd | 32 let rooted_cwd = cwd |
34 .strip_prefix(repo.working_directory_path()) | 33 .strip_prefix(repo.working_directory_path()) |
35 .expect("cwd was already checked within the repository"); | 34 .expect("cwd was already checked within the repository"); |
36 let rooted_cwd = HgPathBuf::from(get_bytes_from_path(rooted_cwd)); | 35 let rooted_cwd = HgPathBuf::from(get_bytes_from_path(rooted_cwd)); |
37 | 36 |