mercurial/ui.py
changeset 40589 054d0fcba2c4
parent 40587 5542bc9125c9
child 40590 83dd8c63a0c6
equal deleted inserted replaced
40588:9683dfb6f13a 40589:054d0fcba2c4
  1010         # opencode timeblockedsection because this is a critical path
  1010         # opencode timeblockedsection because this is a critical path
  1011         starttime = util.timer()
  1011         starttime = util.timer()
  1012         try:
  1012         try:
  1013             if dest is self._ferr and not getattr(self._fout, 'closed', False):
  1013             if dest is self._ferr and not getattr(self._fout, 'closed', False):
  1014                 self._fout.flush()
  1014                 self._fout.flush()
  1015             if self._colormode == 'win32':
  1015             if getattr(dest, 'structured', False):
       
  1016                 # channel for machine-readable output with metadata, where
       
  1017                 # no extra colorization is necessary.
       
  1018                 dest.write(msg, **opts)
       
  1019             elif self._colormode == 'win32':
  1016                 # windows color printing is its own can of crab, defer to
  1020                 # windows color printing is its own can of crab, defer to
  1017                 # the color module and that is it.
  1021                 # the color module and that is it.
  1018                 color.win32print(self, dest.write, msg, **opts)
  1022                 color.win32print(self, dest.write, msg, **opts)
  1019             else:
  1023             else:
  1020                 if self._colormode is not None:
  1024                 if self._colormode is not None:
  1960 def haveprogbar():
  1964 def haveprogbar():
  1961     return _progresssingleton is not None
  1965     return _progresssingleton is not None
  1962 
  1966 
  1963 def _selectmsgdests(ui):
  1967 def _selectmsgdests(ui):
  1964     name = ui.config(b'ui', b'message-output')
  1968     name = ui.config(b'ui', b'message-output')
       
  1969     if name == b'channel':
       
  1970         if ui.fmsg:
       
  1971             return ui.fmsg, ui.fmsg
       
  1972         else:
       
  1973             # fall back to ferr if channel isn't ready so that status/error
       
  1974             # messages can be printed
       
  1975             return ui.ferr, ui.ferr
  1965     if name == b'stdio':
  1976     if name == b'stdio':
  1966         return ui.fout, ui.ferr
  1977         return ui.fout, ui.ferr
  1967     if name == b'stderr':
  1978     if name == b'stderr':
  1968         return ui.ferr, ui.ferr
  1979         return ui.ferr, ui.ferr
  1969     raise error.Abort(b'invalid ui.message-output destination: %s' % name)
  1980     raise error.Abort(b'invalid ui.message-output destination: %s' % name)