]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Disable "color" extension in Mercurial in an extension-agnostic way
authorepriestley <git@epriestley.com>
Wed, 9 Nov 2011 02:21:19 +0000 (18:21 -0800)
committerepriestley <git@epriestley.com>
Wed, 9 Nov 2011 02:32:40 +0000 (18:32 -0800)
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

index 23133ca5c0deb077f3aea2f119c2a23ec2081b4b..a8f2752dfd58c6b4a7811997a4d501f01505a129 100644 (file)
@@ -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);