From 8a7e0b77836f5a3220319c9038453d6a226e6337 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 8 Nov 2011 18:21:19 -0800 Subject: [PATCH] Disable "color" extension in Mercurial in an extension-agnostic way Summary: In D1079, I added "--color never", but this flag is provided by the "color" extension, which is why I missed it originally, because it doesn't show up until you enable that extension. Providing it causes installs which don't have it enabled (disabled is the default) to fail. Use "--config" to disable color instead. This sets a configuration setting and works regardless of whether the color extension is present. Test Plan: Ran "arc diff" in a mercurial working copy with the color extension enabled and disabled. Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran Reviewed By: nh CC: aran, nh Differential Revision: 1092 --- src/repository/api/mercurial/ArcanistMercurialAPI.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/repository/api/mercurial/ArcanistMercurialAPI.php b/src/repository/api/mercurial/ArcanistMercurialAPI.php index 23133ca5..a8f2752d 100644 --- a/src/repository/api/mercurial/ArcanistMercurialAPI.php +++ b/src/repository/api/mercurial/ArcanistMercurialAPI.php @@ -226,7 +226,11 @@ class ArcanistMercurialAPI extends ArcanistRepositoryAPI { private function getDiffOptions() { $options = array( '--git', - '--color never', + // NOTE: We can't use "--color never" because that flag is provided + // by the color extension, which may or may not be enabled. Instead, + // set the color mode configuration so that color is disabled regardless + // of whether the extension is present or not. + '--config color.mode=off', '-U'.$this->getDiffLinesOfContext(), ); return implode(' ', $options);