Mercurial > public > mercurial-scm > hg-stable
diff rust/rhg/src/commands/status.rs @ 50802:f8412da86d05
rust-config: add support for default config items
Now that configitems.toml exists, we can read from it the default values for
all core config items.
We will add the devel-warning for use of undeclared config items in a later
patch when we're done adding the missing entries for `rhg`.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Thu, 06 Jul 2023 14:32:07 +0200 |
parents | f57f5ab0e220 |
children | c112cc9effdc |
line wrap: on
line diff
--- a/rust/rhg/src/commands/status.rs Mon Jan 23 18:08:11 2023 +0100 +++ b/rust/rhg/src/commands/status.rs Thu Jul 06 14:32:07 2023 +0200 @@ -7,7 +7,8 @@ use crate::error::CommandError; use crate::ui::{ - format_pattern_file_warning, print_narrow_sparse_warnings, Ui, + format_pattern_file_warning, print_narrow_sparse_warnings, relative_paths, + RelativePaths, Ui, }; use crate::utils::path_utils::RelativizePaths; use clap::Arg; @@ -360,13 +361,26 @@ } } } - let relative_paths = config + + let relative_status = config .get_option(b"commands", b"status.relative")? - .unwrap_or(config.get_bool(b"ui", b"relative-paths")?); + .expect("commands.status.relative should have a default value"); + + let relativize_paths = relative_status || { + // TODO should be dependent on whether patterns are passed once + // we support those. + // See in Python code with `getuipathfn` usage in `commands.py`. + let legacy_relative_behavior = false; + match relative_paths(invocation.config)? { + RelativePaths::Legacy => legacy_relative_behavior, + RelativePaths::Bool(v) => v, + } + }; + let output = DisplayStatusPaths { ui, no_status, - relativize: if relative_paths { + relativize: if relativize_paths { Some(RelativizePaths::new(repo)?) } else { None