comparison rust/rhg/src/commands/files.rs @ 45937:2ad2745e0be9

rhg: exit with relevant code for unsupported requirements Differential Revision: https://phab.mercurial-scm.org/D9399
author Simon Sapin <simon-commits@exyr.org>
date Tue, 24 Nov 2020 18:52:38 +0100
parents 2f8227a12592
children 904647f7d983
comparison
equal deleted inserted replaced
45936:0ce15a8c7b8b 45937:2ad2745e0be9
9 }; 9 };
10 use hg::operations::{ 10 use hg::operations::{
11 ListRevTrackedFiles, ListRevTrackedFilesError, 11 ListRevTrackedFiles, ListRevTrackedFilesError,
12 ListRevTrackedFilesErrorKind, 12 ListRevTrackedFilesErrorKind,
13 }; 13 };
14 use hg::requirements;
14 use hg::utils::files::{get_bytes_from_path, relativize_path}; 15 use hg::utils::files::{get_bytes_from_path, relativize_path};
15 use hg::utils::hg_path::{HgPath, HgPathBuf}; 16 use hg::utils::hg_path::{HgPath, HgPathBuf};
16 use std::path::PathBuf; 17 use std::path::PathBuf;
17 18
18 pub const HELP_TEXT: &str = " 19 pub const HELP_TEXT: &str = "
55 } 56 }
56 57
57 impl<'a> Command for FilesCommand<'a> { 58 impl<'a> Command for FilesCommand<'a> {
58 fn run(&self, ui: &Ui) -> Result<(), CommandError> { 59 fn run(&self, ui: &Ui) -> Result<(), CommandError> {
59 let root = FindRoot::new().run()?; 60 let root = FindRoot::new().run()?;
61 requirements::check(&root)?;
60 if let Some(rev) = self.rev { 62 if let Some(rev) = self.rev {
61 let mut operation = ListRevTrackedFiles::new(&root, rev) 63 let mut operation = ListRevTrackedFiles::new(&root, rev)
62 .map_err(|e| map_rev_error(rev, e))?; 64 .map_err(|e| map_rev_error(rev, e))?;
63 let files = operation.run().map_err(|e| map_rev_error(rev, e))?; 65 let files = operation.run().map_err(|e| map_rev_error(rev, e))?;
64 self.display_files(ui, &root, files) 66 self.display_files(ui, &root, files)