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 3068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3079 else: | 3079 else: |
3080 # Only generate context-less patches. | 3080 # Only generate context-less patches. |
3081 clang_diff_type = '-U0' | 3081 clang_diff_type = '-U0' |
3082 | 3082 |
3083 diff_cmd = BuildGitDiffCmd(clang_diff_type, upstream_commit, args, CLANG_EXTS) | 3083 diff_cmd = BuildGitDiffCmd(clang_diff_type, upstream_commit, args, CLANG_EXTS) |
3084 diff_output = RunGit(diff_cmd) | 3084 diff_output = RunGit(diff_cmd) |
3085 | 3085 |
3086 top_dir = os.path.normpath( | 3086 top_dir = os.path.normpath( |
3087 RunGit(["rev-parse", "--show-toplevel"]).rstrip('\n')) | 3087 RunGit(["rev-parse", "--show-toplevel"]).rstrip('\n')) |
3088 | 3088 |
3089 # Locate the clang-format binary in the checkout | 3089 # Locate the clang-format binary in the checkout. |
3090 try: | 3090 try: |
3091 clang_format_tool = clang_format.FindClangFormatToolInChromiumTree() | 3091 clang_format_tool = clang_format.FindClangFormatToolInChromiumTree() |
3092 except clang_format.NotFoundError, e: | 3092 except clang_format.NotFoundError, e: |
3093 DieWithError(e) | 3093 DieWithError(e) |
3094 | 3094 |
3095 # Set to 2 to signal to CheckPatchFormatted() that this patch isn't | 3095 # Set to 2 to signal to CheckPatchFormatted() that this patch isn't |
3096 # formatted. This is used to block during the presubmit. | 3096 # formatted. This is used to block during the presubmit. |
3097 return_value = 0 | 3097 return_value = 0 |
3098 | 3098 |
3099 if opts.full: | 3099 if opts.full: |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3204 if __name__ == '__main__': | 3204 if __name__ == '__main__': |
3205 # These affect sys.stdout so do it outside of main() to simplify mocks in | 3205 # These affect sys.stdout so do it outside of main() to simplify mocks in |
3206 # unit testing. | 3206 # unit testing. |
3207 fix_encoding.fix_encoding() | 3207 fix_encoding.fix_encoding() |
3208 colorama.init() | 3208 colorama.init() |
3209 try: | 3209 try: |
3210 sys.exit(main(sys.argv[1:])) | 3210 sys.exit(main(sys.argv[1:])) |
3211 except KeyboardInterrupt: | 3211 except KeyboardInterrupt: |
3212 sys.stderr.write('interrupted\n') | 3212 sys.stderr.write('interrupted\n') |
3213 sys.exit(1) | 3213 sys.exit(1) |
OLD | NEW |