##// END OF EJS Templates
rhg: add ui.plain() and check it before showing relative paths in status...
Pulkit Goyal -
r48990:38deb65d default
parent child Browse files
Show More
@@ -267,7 +267,7 b' fn display_status_paths('
267 relative = config
267 relative = config
268 .get_bool(b"commands", b"status.relative")
268 .get_bool(b"commands", b"status.relative")
269 .unwrap_or(relative);
269 .unwrap_or(relative);
270 if relative {
270 if relative && !ui.plain() {
271 relativize_paths(
271 relativize_paths(
272 repo,
272 repo,
273 paths,
273 paths,
@@ -1,5 +1,6 b''
1 use format_bytes::format_bytes;
1 use format_bytes::format_bytes;
2 use std::borrow::Cow;
2 use std::borrow::Cow;
3 use std::env;
3 use std::io;
4 use std::io;
4 use std::io::{ErrorKind, Write};
5 use std::io::{ErrorKind, Write};
5
6
@@ -49,6 +50,25 b' impl Ui {'
49
50
50 stderr.flush().or_else(handle_stderr_error)
51 stderr.flush().or_else(handle_stderr_error)
51 }
52 }
53
54 /// is plain mode active
55 ///
56 /// Plain mode means that all configuration variables which affect
57 /// the behavior and output of Mercurial should be
58 /// ignored. Additionally, the output should be stable,
59 /// reproducible and suitable for use in scripts or applications.
60 ///
61 /// The only way to trigger plain mode is by setting either the
62 /// `HGPLAIN' or `HGPLAINEXCEPT' environment variables.
63 ///
64 /// The return value can either be
65 /// - False if HGPLAIN is not set, or feature is in HGPLAINEXCEPT
66 /// - False if feature is disabled by default and not included in HGPLAIN
67 /// - True otherwise
68 pub fn plain(&self) -> bool {
69 // TODO: add support for HGPLAINEXCEPT
70 env::var_os("HGPLAIN").is_some()
71 }
52 }
72 }
53
73
54 /// A buffered stdout writer for faster batch printing operations.
74 /// A buffered stdout writer for faster batch printing operations.
General Comments 0
You need to be logged in to leave comments. Login now