--- a/rust/rhg/src/ui.rs Tue Oct 05 18:10:04 2021 +0530
+++ b/rust/rhg/src/ui.rs Fri Jun 25 15:00:08 2021 +0530
@@ -1,5 +1,6 @@
use format_bytes::format_bytes;
use std::borrow::Cow;
+use std::env;
use std::io;
use std::io::{ErrorKind, Write};
@@ -49,6 +50,25 @@
stderr.flush().or_else(handle_stderr_error)
}
+
+ /// is plain mode active
+ ///
+ /// Plain mode means that all configuration variables which affect
+ /// the behavior and output of Mercurial should be
+ /// ignored. Additionally, the output should be stable,
+ /// reproducible and suitable for use in scripts or applications.
+ ///
+ /// The only way to trigger plain mode is by setting either the
+ /// `HGPLAIN' or `HGPLAINEXCEPT' environment variables.
+ ///
+ /// The return value can either be
+ /// - False if HGPLAIN is not set, or feature is in HGPLAINEXCEPT
+ /// - False if feature is disabled by default and not included in HGPLAIN
+ /// - True otherwise
+ pub fn plain(&self) -> bool {
+ // TODO: add support for HGPLAINEXCEPT
+ env::var_os("HGPLAIN").is_some()
+ }
}
/// A buffered stdout writer for faster batch printing operations.