comparison mercurial/ui.py @ 38768:afc4ad706f9c

dispatch: making all hg abortions be output with a specific label This allows abortions to be highlighted specially and separately from warnings - for instance, red is a reasonable color for when hg aborts, but is overly dramatic for most warnings produced elsewhere. Differential Revision: https://phab.mercurial-scm.org/D3967
author Rodrigo Damazio Bovendorp <rdamazio@google.com>
date Thu, 19 Jul 2018 23:22:05 -0700
parents eb2945f0a4a1
children e9740c07158d
comparison
equal deleted inserted replaced
38767:eb2945f0a4a1 38768:afc4ad706f9c
1418 return l.rstrip('\n') 1418 return l.rstrip('\n')
1419 else: 1419 else:
1420 return getpass.getpass('') 1420 return getpass.getpass('')
1421 except EOFError: 1421 except EOFError:
1422 raise error.ResponseExpected() 1422 raise error.ResponseExpected()
1423
1423 def status(self, *msg, **opts): 1424 def status(self, *msg, **opts):
1424 '''write status message to output (if ui.quiet is False) 1425 '''write status message to output (if ui.quiet is False)
1425 1426
1426 This adds an output label of "ui.status". 1427 This adds an output label of "ui.status".
1427 ''' 1428 '''
1428 if not self.quiet: 1429 if not self.quiet:
1429 opts[r'label'] = opts.get(r'label', '') + ' ui.status' 1430 opts[r'label'] = opts.get(r'label', '') + ' ui.status'
1430 self.write(*msg, **opts) 1431 self.write(*msg, **opts)
1432
1431 def warn(self, *msg, **opts): 1433 def warn(self, *msg, **opts):
1432 '''write warning message to output (stderr) 1434 '''write warning message to output (stderr)
1433 1435
1434 This adds an output label of "ui.warning". 1436 This adds an output label of "ui.warning".
1435 ''' 1437 '''
1436 opts[r'label'] = opts.get(r'label', '') + ' ui.warning' 1438 opts[r'label'] = opts.get(r'label', '') + ' ui.warning'
1437 self.write_err(*msg, **opts) 1439 self.write_err(*msg, **opts)
1440
1441 def error(self, *msg, **opts):
1442 '''write error message to output (stderr)
1443
1444 This adds an output label of "ui.error".
1445 '''
1446 opts[r'label'] = opts.get(r'label', '') + ' ui.error'
1447 self.write_err(*msg, **opts)
1448
1438 def note(self, *msg, **opts): 1449 def note(self, *msg, **opts):
1439 '''write note to output (if ui.verbose is True) 1450 '''write note to output (if ui.verbose is True)
1440 1451
1441 This adds an output label of "ui.note". 1452 This adds an output label of "ui.note".
1442 ''' 1453 '''
1443 if self.verbose: 1454 if self.verbose:
1444 opts[r'label'] = opts.get(r'label', '') + ' ui.note' 1455 opts[r'label'] = opts.get(r'label', '') + ' ui.note'
1445 self.write(*msg, **opts) 1456 self.write(*msg, **opts)
1457
1446 def debug(self, *msg, **opts): 1458 def debug(self, *msg, **opts):
1447 '''write debug message to output (if ui.debugflag is True) 1459 '''write debug message to output (if ui.debugflag is True)
1448 1460
1449 This adds an output label of "ui.debug". 1461 This adds an output label of "ui.debug".
1450 ''' 1462 '''