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 3551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3562 try: | 3562 try: |
3563 command = [dart_format.FindDartFmtToolInChromiumTree()] | 3563 command = [dart_format.FindDartFmtToolInChromiumTree()] |
3564 if not opts.dry_run and not opts.diff: | 3564 if not opts.dry_run and not opts.diff: |
3565 command.append('-w') | 3565 command.append('-w') |
3566 command.extend(dart_diff_output.splitlines()) | 3566 command.extend(dart_diff_output.splitlines()) |
3567 | 3567 |
3568 stdout = RunCommand(command, cwd=top_dir, env=env) | 3568 stdout = RunCommand(command, cwd=top_dir, env=env) |
3569 if opts.dry_run and stdout: | 3569 if opts.dry_run and stdout: |
3570 return_value = 2 | 3570 return_value = 2 |
3571 except dart_format.NotFoundError as e: | 3571 except dart_format.NotFoundError as e: |
3572 print ('Unable to check dart code formatting. Dart SDK is not in ' + | 3572 print ('Warning: Unable to check Dart code formatting. Dart SDK not ' + |
3573 'this checkout.') | 3573 'found in this checkout. Files in other languages are still ' + |
| 3574 'formatted.') |
3574 | 3575 |
3575 return return_value | 3576 return return_value |
3576 | 3577 |
3577 | 3578 |
3578 @subcommand.usage('<codereview url or issue id>') | 3579 @subcommand.usage('<codereview url or issue id>') |
3579 def CMDcheckout(parser, args): | 3580 def CMDcheckout(parser, args): |
3580 """Checks out a branch associated with a given Rietveld issue.""" | 3581 """Checks out a branch associated with a given Rietveld issue.""" |
3581 _, args = parser.parse_args(args) | 3582 _, args = parser.parse_args(args) |
3582 | 3583 |
3583 if len(args) != 1: | 3584 if len(args) != 1: |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3671 if __name__ == '__main__': | 3672 if __name__ == '__main__': |
3672 # These affect sys.stdout so do it outside of main() to simplify mocks in | 3673 # These affect sys.stdout so do it outside of main() to simplify mocks in |
3673 # unit testing. | 3674 # unit testing. |
3674 fix_encoding.fix_encoding() | 3675 fix_encoding.fix_encoding() |
3675 colorama.init() | 3676 colorama.init() |
3676 try: | 3677 try: |
3677 sys.exit(main(sys.argv[1:])) | 3678 sys.exit(main(sys.argv[1:])) |
3678 except KeyboardInterrupt: | 3679 except KeyboardInterrupt: |
3679 sys.stderr.write('interrupted\n') | 3680 sys.stderr.write('interrupted\n') |
3680 sys.exit(1) | 3681 sys.exit(1) |
OLD | NEW |