4 use clap::App; |
4 use clap::App; |
5 use clap::AppSettings; |
5 use clap::AppSettings; |
6 use clap::Arg; |
6 use clap::Arg; |
7 use clap::ArgMatches; |
7 use clap::ArgMatches; |
8 use format_bytes::{format_bytes, join}; |
8 use format_bytes::{format_bytes, join}; |
9 use hg::config::{Config, ConfigSource}; |
9 use hg::config::{Config, ConfigSource, PlainInfo}; |
10 use hg::repo::{Repo, RepoError}; |
10 use hg::repo::{Repo, RepoError}; |
11 use hg::utils::files::{get_bytes_from_os_str, get_path_from_bytes}; |
11 use hg::utils::files::{get_bytes_from_os_str, get_path_from_bytes}; |
12 use hg::utils::SliceExt; |
12 use hg::utils::SliceExt; |
13 use hg::{exit_codes, requirements}; |
13 use hg::{exit_codes, requirements}; |
|
14 use std::borrow::Cow; |
14 use std::collections::HashSet; |
15 use std::collections::HashSet; |
15 use std::ffi::OsString; |
16 use std::ffi::OsString; |
16 use std::os::unix::prelude::CommandExt; |
17 use std::os::unix::prelude::CommandExt; |
17 use std::path::PathBuf; |
18 use std::path::PathBuf; |
18 use std::process::Command; |
19 use std::process::Command; |
324 let config = if let Ok(repo) = &repo_result { |
325 let config = if let Ok(repo) = &repo_result { |
325 repo.config() |
326 repo.config() |
326 } else { |
327 } else { |
327 &non_repo_config |
328 &non_repo_config |
328 }; |
329 }; |
|
330 |
|
331 let mut config_cow = Cow::Borrowed(config); |
|
332 if ui::plain(None) { |
|
333 config_cow.to_mut().apply_plain(PlainInfo { |
|
334 plain: true, |
|
335 plainalias: ui::plain(Some("alias")), |
|
336 plainrevsetalias: ui::plain(Some("revsetalias")), |
|
337 plaintemplatealias: ui::plain(Some("templatealias")), |
|
338 }) |
|
339 }; |
|
340 let config = config_cow.as_ref(); |
|
341 |
329 let ui = Ui::new(&config).unwrap_or_else(|error| { |
342 let ui = Ui::new(&config).unwrap_or_else(|error| { |
330 exit( |
343 exit( |
331 &argv, |
344 &argv, |
332 &initial_current_dir, |
345 &initial_current_dir, |
333 &Ui::new_infallible(&config), |
346 &Ui::new_infallible(&config), |