mercurial/ui.py
changeset 31087 894bdcdc75df
parent 31083 c42feb5f3143
child 31090 e9f96ccf36a6
equal deleted inserted replaced
31086:e6082078c853 31087:894bdcdc75df
    24 
    24 
    25 from .i18n import _
    25 from .i18n import _
    26 from .node import hex
    26 from .node import hex
    27 
    27 
    28 from . import (
    28 from . import (
       
    29     color,
    29     config,
    30     config,
    30     encoding,
    31     encoding,
    31     error,
    32     error,
    32     formatter,
    33     formatter,
    33     progress,
    34     progress,
  1362         '''
  1363         '''
  1363 
  1364 
  1364     def label(self, msg, label):
  1365     def label(self, msg, label):
  1365         '''style msg based on supplied label
  1366         '''style msg based on supplied label
  1366 
  1367 
  1367         Like ui.write(), this just returns msg unchanged, but extensions
  1368         If some color mode is enabled, this will add the necessary control
  1368         and GUI tools can override it to allow styling output without
  1369         characters to apply such color. In addition, 'debug' color mode adds
  1369         writing it.
  1370         markup showing which label affects a piece of text.
  1370 
  1371 
  1371         ui.write(s, 'label') is equivalent to
  1372         ui.write(s, 'label') is equivalent to
  1372         ui.write(ui.label(s, 'label')).
  1373         ui.write(ui.label(s, 'label')).
  1373         '''
  1374         '''
       
  1375         if self._colormode is not None:
       
  1376             return color.colorlabel(self, msg, label)
  1374         return msg
  1377         return msg
  1375 
  1378 
  1376     def develwarn(self, msg, stacklevel=1, config=None):
  1379     def develwarn(self, msg, stacklevel=1, config=None):
  1377         """issue a developer warning message
  1380         """issue a developer warning message
  1378 
  1381