rust/rhg/src/commands/files.rs
changeset 46134 cc6faec62cb7
parent 46032 8d6164098782
child 46135 dca9cb99971c
equal deleted inserted replaced
46133:0a4d47f4337b 46134:cc6faec62cb7
    12     ListRevTrackedFilesErrorKind,
    12     ListRevTrackedFilesErrorKind,
    13 };
    13 };
    14 use hg::requirements;
    14 use hg::requirements;
    15 use hg::utils::files::{get_bytes_from_path, relativize_path};
    15 use hg::utils::files::{get_bytes_from_path, relativize_path};
    16 use hg::utils::hg_path::{HgPath, HgPathBuf};
    16 use hg::utils::hg_path::{HgPath, HgPathBuf};
    17 use std::path::PathBuf;
    17 use std::path::Path;
    18 
    18 
    19 pub const HELP_TEXT: &str = "
    19 pub const HELP_TEXT: &str = "
    20 List tracked files.
    20 List tracked files.
    21 
    21 
    22 Returns 0 on success.
    22 Returns 0 on success.
    32     }
    32     }
    33 
    33 
    34     fn display_files(
    34     fn display_files(
    35         &self,
    35         &self,
    36         ui: &Ui,
    36         ui: &Ui,
    37         root: &PathBuf,
    37         root: &Path,
    38         files: impl IntoIterator<Item = &'a HgPath>,
    38         files: impl IntoIterator<Item = &'a HgPath>,
    39     ) -> Result<(), CommandError> {
    39     ) -> Result<(), CommandError> {
    40         let cwd = std::env::current_dir()
    40         let cwd = std::env::current_dir()
    41             .or_else(|e| Err(CommandErrorKind::CurrentDirNotFound(e)))?;
    41             .or_else(|e| Err(CommandErrorKind::CurrentDirNotFound(e)))?;
    42         let rooted_cwd = cwd
    42         let rooted_cwd = cwd
    43             .strip_prefix(&root)
    43             .strip_prefix(root)
    44             .expect("cwd was already checked within the repository");
    44             .expect("cwd was already checked within the repository");
    45         let rooted_cwd = HgPathBuf::from(get_bytes_from_path(rooted_cwd));
    45         let rooted_cwd = HgPathBuf::from(get_bytes_from_path(rooted_cwd));
    46 
    46 
    47         let mut stdout = ui.stdout_buffer();
    47         let mut stdout = ui.stdout_buffer();
    48 
    48