| 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 3816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3827 | 3827 |
| 3828 # Dart's formatter does not have the nice property of only operating on | 3828 # Dart's formatter does not have the nice property of only operating on |
| 3829 # modified chunks, so hard code full. | 3829 # modified chunks, so hard code full. |
| 3830 if dart_diff_files: | 3830 if dart_diff_files: |
| 3831 try: | 3831 try: |
| 3832 command = [dart_format.FindDartFmtToolInChromiumTree()] | 3832 command = [dart_format.FindDartFmtToolInChromiumTree()] |
| 3833 if not opts.dry_run and not opts.diff: | 3833 if not opts.dry_run and not opts.diff: |
| 3834 command.append('-w') | 3834 command.append('-w') |
| 3835 command.extend(dart_diff_files) | 3835 command.extend(dart_diff_files) |
| 3836 | 3836 |
| 3837 stdout = RunCommand(command, cwd=top_dir, env=env) | 3837 stdout = RunCommand(command, cwd=top_dir) |
| 3838 if opts.dry_run and stdout: | 3838 if opts.dry_run and stdout: |
| 3839 return_value = 2 | 3839 return_value = 2 |
| 3840 except dart_format.NotFoundError as e: | 3840 except dart_format.NotFoundError as e: |
| 3841 print ('Warning: Unable to check Dart code formatting. Dart SDK not ' + | 3841 print ('Warning: Unable to check Dart code formatting. Dart SDK not ' + |
| 3842 'found in this checkout. Files in other languages are still ' + | 3842 'found in this checkout. Files in other languages are still ' + |
| 3843 'formatted.') | 3843 'formatted.') |
| 3844 | 3844 |
| 3845 # Format GN build files. Always run on full build files for canonical form. | 3845 # Format GN build files. Always run on full build files for canonical form. |
| 3846 if gn_diff_files: | 3846 if gn_diff_files: |
| 3847 cmd = ['gn', 'format'] | 3847 cmd = ['gn', 'format'] |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3951 if __name__ == '__main__': | 3951 if __name__ == '__main__': |
| 3952 # These affect sys.stdout so do it outside of main() to simplify mocks in | 3952 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 3953 # unit testing. | 3953 # unit testing. |
| 3954 fix_encoding.fix_encoding() | 3954 fix_encoding.fix_encoding() |
| 3955 colorama.init() | 3955 colorama.init() |
| 3956 try: | 3956 try: |
| 3957 sys.exit(main(sys.argv[1:])) | 3957 sys.exit(main(sys.argv[1:])) |
| 3958 except KeyboardInterrupt: | 3958 except KeyboardInterrupt: |
| 3959 sys.stderr.write('interrupted\n') | 3959 sys.stderr.write('interrupted\n') |
| 3960 sys.exit(1) | 3960 sys.exit(1) |
| OLD | NEW |