[Commented On] D11762: rhg: Colored output is not supported
baymax (Baymax, Your Personal Patch-care Companion)
phabricator at mercurial-scm.org
Fri Nov 26 15:34:16 UTC 2021
baymax added a comment.
baymax updated this revision to Diff 31160.
✅ refresh by Heptapod after a successful CI run (🐙 💚)
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D11762?vs=31147&id=31160
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D11762/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D11762
AFFECTED FILES
rust/rhg/src/main.rs
tests/test-status-color.t
CHANGE DETAILS
diff --git a/tests/test-status-color.t b/tests/test-status-color.t
--- a/tests/test-status-color.t
+++ b/tests/test-status-color.t
@@ -1,7 +1,3 @@
-TODO: fix rhg bugs that make this test fail when status is enabled
- $ unset RHG_STATUS
-
-
$ cat <<EOF >> $HGRCPATH
> [ui]
> color = always
diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs
--- a/rust/rhg/src/main.rs
+++ b/rust/rhg/src/main.rs
@@ -28,7 +28,7 @@
repo: Result<&Repo, &NoRepoInCwdError>,
config: &Config,
) -> Result<(), CommandError> {
- check_unsupported(config)?;
+ check_unsupported(config, ui)?;
let app = App::new("rhg")
.global_setting(AppSettings::AllowInvalidUtf8)
@@ -617,7 +617,10 @@
}
}
-fn check_unsupported(config: &Config) -> Result<(), CommandError> {
+fn check_unsupported(
+ config: &Config,
+ ui: &ui::Ui,
+) -> Result<(), CommandError> {
check_extensions(config)?;
if std::env::var_os("HG_PENDING").is_some() {
@@ -634,5 +637,11 @@
Err(CommandError::unsupported("[decode] config"))?
}
+ if let Some(color) = config.get(b"ui", b"color") {
+ if (color == b"always" || color == b"debug") && !ui.plain() {
+ Err(CommandError::unsupported("colored output"))?
+ }
+ }
+
Ok(())
}
To: SimonSapin, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211126/756ec32a/attachment-0002.html>
More information about the Mercurial-patches
mailing list