color: drop use of the 'global' keyword for '_style'
Using 'global' is usually a bad sign. Here it is used so that one can empty the
content of a dict at the global scope. We '_style.clear()' and drop the global.
--- a/hgext/color.py Fri Nov 18 18:27:13 2016 +0100
+++ b/hgext/color.py Fri Nov 18 18:29:19 2016 +0100
@@ -546,10 +546,9 @@
return _debugdisplaycolor(ui)
def _debugdisplaycolor(ui):
- global _styles
- oldstyle = _styles
+ oldstyle = _styles.copy()
try:
- _styles = {}
+ _styles.clear()
for effect in _effects.keys():
_styles[effect] = effect
if _terminfo_params:
@@ -565,7 +564,8 @@
for colorname, label in items:
ui.write(('%s\n') % colorname, label=label)
finally:
- _styles = oldstyle
+ _styles.clear()
+ _styles.update(oldstyle)
def _debugdisplaystyle(ui):
ui.write(_('available style:\n'))