comparison rust/rhg/src/commands/files.rs @ 50536:74e4dbb0fcd5

rhg: make `rhg files` work if `ui.relative-files=true` is specified
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Mon, 29 May 2023 16:53:18 +0100
parents e57f76c28f7b
children 9db197c73138
comparison
equal deleted inserted replaced
50535:a7513d0d451b 50536:74e4dbb0fcd5
1 use crate::error::CommandError; 1 use crate::error::CommandError;
2 use crate::ui::{print_narrow_sparse_warnings, Ui}; 2 use crate::ui::{print_narrow_sparse_warnings, Ui, RelativePaths, relative_paths};
3 use crate::utils::path_utils::RelativizePaths; 3 use crate::utils::path_utils::RelativizePaths;
4 use clap::Arg; 4 use clap::Arg;
5 use hg::narrow; 5 use hg::narrow;
6 use hg::operations::list_rev_tracked_files; 6 use hg::operations::list_rev_tracked_files;
7 use hg::repo::Repo; 7 use hg::repo::Repo;
26 ) 26 )
27 .about(HELP_TEXT) 27 .about(HELP_TEXT)
28 } 28 }
29 29
30 pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { 30 pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
31 let relative = invocation.config.get(b"ui", b"relative-paths"); 31 match relative_paths(invocation.config)? {
32 if relative.is_some() { 32 RelativePaths::Legacy | RelativePaths::Bool(true) => (),
33 RelativePaths::Bool(false) => {
33 return Err(CommandError::unsupported( 34 return Err(CommandError::unsupported(
34 "non-default ui.relative-paths", 35 "non-default ui.relative-paths",
35 )); 36 ));
37 }
36 } 38 }
37 39
38 let rev = invocation.subcommand_args.get_one::<String>("rev"); 40 let rev = invocation.subcommand_args.get_one::<String>("rev");
39 41
40 let repo = invocation.repo?; 42 let repo = invocation.repo?;