##// END OF EJS Templates
rhg: Pass a &Config to Ui::new...
Simon Sapin -
r49581:1aaf11e3 default
parent child Browse files
Show More
@@ -84,6 +84,11 b' impl fmt::Display for ConfigValueParseEr'
84 84 }
85 85
86 86 impl Config {
87 /// The configuration to use when printing configuration-loading errors
88 pub fn empty() -> Self {
89 Self { layers: Vec::new() }
90 }
91
87 92 /// Load system and user configuration from various files.
88 93 ///
89 94 /// This is also affected by some environment variables.
@@ -137,7 +137,6 b' fn main() {'
137 137 let process_start_time = blackbox::ProcessStartTime::now();
138 138
139 139 env_logger::init();
140 let ui = ui::Ui::new();
141 140
142 141 let early_args = EarlyArgs::parse(std::env::args_os());
143 142
@@ -151,7 +150,7 b' fn main() {'
151 150 .unwrap_or_else(|error| {
152 151 exit(
153 152 &None,
154 &ui,
153 &Ui::new(&Config::empty()),
155 154 OnUnsupported::Abort,
156 155 Err(CommandError::abort(format!(
157 156 "abort: {}: '{}'",
@@ -172,7 +171,7 b' fn main() {'
172 171
173 172 exit(
174 173 &initial_current_dir,
175 &ui,
174 &Ui::new(&Config::empty()),
176 175 on_unsupported,
177 176 Err(error.into()),
178 177 false,
@@ -184,7 +183,7 b' fn main() {'
184 183 .unwrap_or_else(|error| {
185 184 exit(
186 185 &initial_current_dir,
187 &ui,
186 &Ui::new(&non_repo_config),
188 187 OnUnsupported::from_config(&non_repo_config),
189 188 Err(error.into()),
190 189 non_repo_config
@@ -202,7 +201,7 b' fn main() {'
202 201 if SCHEME_RE.is_match(&repo_path_bytes) {
203 202 exit(
204 203 &initial_current_dir,
205 &ui,
204 &Ui::new(&non_repo_config),
206 205 OnUnsupported::from_config(&non_repo_config),
207 206 Err(CommandError::UnsupportedFeature {
208 207 message: format_bytes!(
@@ -292,7 +291,7 b' fn main() {'
292 291 }
293 292 Err(error) => exit(
294 293 &initial_current_dir,
295 &ui,
294 &Ui::new(&non_repo_config),
296 295 OnUnsupported::from_config(&non_repo_config),
297 296 Err(error.into()),
298 297 // TODO: show a warning or combine with original error if
@@ -308,6 +307,7 b' fn main() {'
308 307 } else {
309 308 &non_repo_config
310 309 };
310 let ui = Ui::new(&config);
311 311 let on_unsupported = OnUnsupported::from_config(config);
312 312
313 313 let result = main_with_result(
@@ -1,4 +1,5 b''
1 1 use format_bytes::format_bytes;
2 use hg::config::Config;
2 3 use hg::utils::files::get_bytes_from_os_string;
3 4 use std::borrow::Cow;
4 5 use std::env;
@@ -21,7 +22,7 b' pub enum UiError {'
21 22
22 23 /// The commandline user interface
23 24 impl Ui {
24 pub fn new() -> Self {
25 pub fn new(_config: &Config) -> Self {
25 26 Ui {
26 27 stdout: std::io::stdout(),
27 28 stderr: std::io::stderr(),
General Comments 0
You need to be logged in to leave comments. Login now