| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
| 7 | 7 |
| 8 """A git-command for integrating reviews on Rietveld.""" | 8 """A git-command for integrating reviews on Rietveld.""" |
| 9 | 9 |
| 10 from distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
| (...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 except ValueError: | 1455 except ValueError: |
| 1456 DieWithError('A review issue id is expected to be a number') | 1456 DieWithError('A review issue id is expected to be a number') |
| 1457 | 1457 |
| 1458 cl = Changelist(issue=issue) | 1458 cl = Changelist(issue=issue) |
| 1459 | 1459 |
| 1460 if options.comment: | 1460 if options.comment: |
| 1461 cl.AddComment(options.comment) | 1461 cl.AddComment(options.comment) |
| 1462 return 0 | 1462 return 0 |
| 1463 | 1463 |
| 1464 data = cl.GetIssueProperties() | 1464 data = cl.GetIssueProperties() |
| 1465 for message in sorted(data['messages'], key=lambda x: x['date']): | 1465 for message in sorted(data.get('messages', []), key=lambda x: x['date']): |
| 1466 if message['disapproval']: | 1466 if message['disapproval']: |
| 1467 color = Fore.RED | 1467 color = Fore.RED |
| 1468 elif message['approval']: | 1468 elif message['approval']: |
| 1469 color = Fore.GREEN | 1469 color = Fore.GREEN |
| 1470 elif message['sender'] == data['owner_email']: | 1470 elif message['sender'] == data['owner_email']: |
| 1471 color = Fore.MAGENTA | 1471 color = Fore.MAGENTA |
| 1472 else: | 1472 else: |
| 1473 color = Fore.BLUE | 1473 color = Fore.BLUE |
| 1474 print '\n%s%s %s%s' % ( | 1474 print '\n%s%s %s%s' % ( |
| 1475 color, message['date'].split('.', 1)[0], message['sender'], | 1475 color, message['date'].split('.', 1)[0], message['sender'], |
| (...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2887 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2887 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 2888 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2888 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
| 2889 | 2889 |
| 2890 | 2890 |
| 2891 if __name__ == '__main__': | 2891 if __name__ == '__main__': |
| 2892 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2892 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 2893 # unit testing. | 2893 # unit testing. |
| 2894 fix_encoding.fix_encoding() | 2894 fix_encoding.fix_encoding() |
| 2895 colorama.init() | 2895 colorama.init() |
| 2896 sys.exit(main(sys.argv[1:])) | 2896 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |