Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index a93a04b27ac2b1888b4f49520f52387ef0ef04c6..05c0e68111a2c90ae6953304e126ebd4713a8381 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -24,7 +24,10 @@ except ImportError: |
| pass |
| +from third_party import colorama |
| from third_party import upload |
| +# Import shortcut. |
| +from third_party.colorama import Fore |
|
iannucci
2013/05/07 01:49:50
Fore = colorama.Fore ?
M-A Ruel
2013/05/07 02:03:58
Done.
|
| import breakpad # pylint: disable=W0611 |
| import fix_encoding |
| import gclient_utils |
| @@ -1101,7 +1104,17 @@ def CMDcomments(parser, args): |
| if cl.GetIssue(): |
| data = cl.RpcServer().get_issue_properties(cl.GetIssue(), True) |
| for message in sorted(data['messages'], key=lambda x: x['date']): |
| - print '\n%s %s' % (message['date'].split('.', 1)[0], message['sender']) |
| + if message['disapproval']: |
| + color = Fore.RED |
| + elif message['approval']: |
| + color = Fore.GREEN |
| + elif message['sender'] == data['owner_email']: |
| + color = Fore.MAGENTA |
| + else: |
| + color = Fore.BLUE |
| + print '\n%s%s %s%s' % ( |
| + color, message['date'].split('.', 1)[0], message['sender'], |
| + Fore.RESET) |
| if message['text'].strip(): |
| print '\n'.join(' ' + l for l in message['text'].splitlines()) |
| return 0 |
| @@ -1994,6 +2007,7 @@ def main(argv): |
| '\nYour python version %s is unsupported, please upgrade.\n' % |
| sys.version.split(' ', 1)[0]) |
| return 2 |
| + |
| # Reload settings. |
| global settings |
| settings = Settings() |
| @@ -2040,5 +2054,8 @@ def main(argv): |
| if __name__ == '__main__': |
| + # These affect sys.stdout so do it outside of main() to simplify mocks in |
| + # unit testing. |
| fix_encoding.fix_encoding() |
| + colorama.init() |
| sys.exit(main(sys.argv[1:])) |