equal
deleted
inserted
replaced
5 // This software may be used and distributed according to the terms of the |
5 // This software may be used and distributed according to the terms of the |
6 // GNU General Public License version 2 or any later version. |
6 // GNU General Public License version 2 or any later version. |
7 |
7 |
8 use crate::error::CommandError; |
8 use crate::error::CommandError; |
9 use crate::ui::{ |
9 use crate::ui::{ |
10 format_pattern_file_warning, print_narrow_sparse_warnings, Ui, |
10 format_pattern_file_warning, print_narrow_sparse_warnings, relative_paths, |
|
11 RelativePaths, Ui, |
11 }; |
12 }; |
12 use crate::utils::path_utils::RelativizePaths; |
13 use crate::utils::path_utils::RelativizePaths; |
13 use clap::Arg; |
14 use clap::Arg; |
14 use format_bytes::format_bytes; |
15 use format_bytes::format_bytes; |
15 use hg::config::Config; |
16 use hg::config::Config; |
358 } |
359 } |
359 } |
360 } |
360 } |
361 } |
361 } |
362 } |
362 } |
363 } |
363 let relative_paths = config |
364 |
|
365 let relative_status = config |
364 .get_option(b"commands", b"status.relative")? |
366 .get_option(b"commands", b"status.relative")? |
365 .unwrap_or(config.get_bool(b"ui", b"relative-paths")?); |
367 .expect("commands.status.relative should have a default value"); |
|
368 |
|
369 let relativize_paths = relative_status || { |
|
370 // TODO should be dependent on whether patterns are passed once |
|
371 // we support those. |
|
372 // See in Python code with `getuipathfn` usage in `commands.py`. |
|
373 let legacy_relative_behavior = false; |
|
374 match relative_paths(invocation.config)? { |
|
375 RelativePaths::Legacy => legacy_relative_behavior, |
|
376 RelativePaths::Bool(v) => v, |
|
377 } |
|
378 }; |
|
379 |
366 let output = DisplayStatusPaths { |
380 let output = DisplayStatusPaths { |
367 ui, |
381 ui, |
368 no_status, |
382 no_status, |
369 relativize: if relative_paths { |
383 relativize: if relativize_paths { |
370 Some(RelativizePaths::new(repo)?) |
384 Some(RelativizePaths::new(repo)?) |
371 } else { |
385 } else { |
372 None |
386 None |
373 }, |
387 }, |
374 print0, |
388 print0, |