Patchwork [8,of,8,V2] color: rename '_styles' to '_defaultstyles' for clarity

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 28, 2017, 10:54 a.m.
Message ID <a41cd9cef1827745345a.1488279272@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18836/
State Accepted
Delegated to: Martin von Zweigbergk
Headers show

Comments

Pierre-Yves David - Feb. 28, 2017, 10:54 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1478459814 -3600
#      Sun Nov 06 20:16:54 2016 +0100
# Node ID a41cd9cef1827745345adbbc4e5db1bee828ddcf
# Parent  9a08f902da2abeb6cadae6526874327e01943e61
# EXP-Topic color
color: rename '_styles' to '_defaultstyles' for clarity

This should make it clear the dict is only used for new config. Extensions
should not modify it directly anyway since we have 'extraloader' logic for
loading '_styles' too.

(as the indenting was touched, we fix it to be more standard).
via Mercurial-devel - Feb. 28, 2017, 6:37 p.m.
On Tue, Feb 28, 2017 at 2:54 AM, Pierre-Yves David
<pierre-yves.david@ens-lyon.org> wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1478459814 -3600
> #      Sun Nov 06 20:16:54 2016 +0100
> # Node ID a41cd9cef1827745345adbbc4e5db1bee828ddcf
> # Parent  9a08f902da2abeb6cadae6526874327e01943e61
> # EXP-Topic color
> color: rename '_styles' to '_defaultstyles' for clarity
>
> This should make it clear the dict is only used for new config. Extensions
> should not modify it directly anyway since we have 'extraloader' logic for
> loading '_styles' too.
>
> (as the indenting was touched, we fix it to be more standard).

Queued with the above line dropped. Thanks!

>
> diff --git a/mercurial/color.py b/mercurial/color.py
> --- a/mercurial/color.py
> +++ b/mercurial/color.py
> @@ -72,7 +72,7 @@ except ImportError:
>      'white_background': 47,
>      }
>
> -_styles = {
> +_defaultstyles = {
>      'grep.match': 'red bold',
>      'grep.linenumber': 'green',
>      'grep.rev': 'green',
> @@ -129,7 +129,7 @@ except ImportError:
>  }
>
>  def loadcolortable(ui, extname, colortable):
> -    _styles.update(colortable)
> +    _defaultstyles.update(colortable)
>
>  def _terminfosetup(ui, mode):
>      '''Initialize terminfo data and the terminal if we're in terminfo mode.'''
> @@ -254,7 +254,7 @@ def _modesetup(ui):
>      return None
>
>  def configstyles(ui):
> -    ui._styles.update(_styles)
> +    ui._styles.update(_defaultstyles)
>      for status, cfgeffects in ui.configitems('color'):
>          if '.' not in status or status.startswith(('color.', 'terminfo.')):
>              continue
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -72,7 +72,7 @@  except ImportError:
     'white_background': 47,
     }
 
-_styles = {
+_defaultstyles = {
     'grep.match': 'red bold',
     'grep.linenumber': 'green',
     'grep.rev': 'green',
@@ -129,7 +129,7 @@  except ImportError:
 }
 
 def loadcolortable(ui, extname, colortable):
-    _styles.update(colortable)
+    _defaultstyles.update(colortable)
 
 def _terminfosetup(ui, mode):
     '''Initialize terminfo data and the terminal if we're in terminfo mode.'''
@@ -254,7 +254,7 @@  def _modesetup(ui):
     return None
 
 def configstyles(ui):
-    ui._styles.update(_styles)
+    ui._styles.update(_defaultstyles)
     for status, cfgeffects in ui.configitems('color'):
         if '.' not in status or status.startswith(('color.', 'terminfo.')):
             continue