Patchwork [3,of,9] color: drop the _enabledbydefault module variable

login
register
mail settings
Submitter Boris Feld
Date July 15, 2017, 6:41 p.m.
Message ID <151a6237b3445206b854.1500144066@FB>
Download mbox | patch
Permalink /patch/22407/
State Accepted
Headers show

Comments

Boris Feld - July 15, 2017, 6:41 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1500120886 -7200
#      Sat Jul 15 14:14:46 2017 +0200
# Node ID 151a6237b3445206b8547da91545bdc21a023bb9
# Parent  16b7d5ec9fb0e85e2f4a1f018f031439bc4500ab
# EXP-Topic config.register.special-case
color: drop the _enabledbydefault module variable

Since color is on by default, cleanup the now useless variable in both core
and color extension.

Patch

diff -r 16b7d5ec9fb0 -r 151a6237b344 hgext/color.py
--- a/hgext/color.py	Fri Jun 30 03:44:45 2017 +0200
+++ b/hgext/color.py	Sat Jul 15 14:14:46 2017 +0200
@@ -18,14 +18,8 @@ 
 
 from __future__ import absolute_import
 
-from mercurial import color
-
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
 # be specifying the version(s) of Mercurial they are tested with, or
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
-
-def extsetup(ui):
-    # change default color config
-    color._enabledbydefault = True
diff -r 16b7d5ec9fb0 -r 151a6237b344 mercurial/color.py
--- a/mercurial/color.py	Fri Jun 30 03:44:45 2017 +0200
+++ b/mercurial/color.py	Sat Jul 15 14:14:46 2017 +0200
@@ -45,8 +45,6 @@ 
     curses = None
     _baseterminfoparams = {}
 
-_enabledbydefault = True
-
 # start and stop parameters for effects
 _effects = {
     'none': 0,
@@ -185,10 +183,7 @@ 
 def _modesetup(ui):
     if ui.plain():
         return None
-    default = 'never'
-    if _enabledbydefault:
-        default = 'auto'
-    config = ui.config('ui', 'color', default)
+    config = ui.config('ui', 'color', 'auto')
     if config == 'debug':
         return 'debug'