| 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 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 [f.LocalPath() for f in | 2299 [f.LocalPath() for f in |
| 2300 cl.GetChange(base_branch, None).AffectedFiles()], | 2300 cl.GetChange(base_branch, None).AffectedFiles()], |
| 2301 change.RepositoryRoot(), author, | 2301 change.RepositoryRoot(), author, |
| 2302 fopen=file, os_path=os.path, glob=glob.glob, | 2302 fopen=file, os_path=os.path, glob=glob.glob, |
| 2303 disable_color=options.no_color).run() | 2303 disable_color=options.no_color).run() |
| 2304 | 2304 |
| 2305 | 2305 |
| 2306 @subcommand.usage('[files or directories to diff]') | 2306 @subcommand.usage('[files or directories to diff]') |
| 2307 def CMDformat(parser, args): | 2307 def CMDformat(parser, args): |
| 2308 """Runs clang-format on the diff.""" | 2308 """Runs clang-format on the diff.""" |
| 2309 CLANG_EXTS = ['.cc', '.cpp', '.h'] | 2309 CLANG_EXTS = ['.cc', '.cpp', '.h', '.mm'] |
| 2310 parser.add_option('--full', action='store_true', | 2310 parser.add_option('--full', action='store_true', |
| 2311 help='Reformat the full content of all touched files') | 2311 help='Reformat the full content of all touched files') |
| 2312 parser.add_option('--dry-run', action='store_true', | 2312 parser.add_option('--dry-run', action='store_true', |
| 2313 help='Don\'t modify any file on disk.') | 2313 help='Don\'t modify any file on disk.') |
| 2314 opts, args = parser.parse_args(args) | 2314 opts, args = parser.parse_args(args) |
| 2315 | 2315 |
| 2316 # git diff generates paths against the root of the repository. Change | 2316 # git diff generates paths against the root of the repository. Change |
| 2317 # to that directory so clang-format can find files even within subdirs. | 2317 # to that directory so clang-format can find files even within subdirs. |
| 2318 rel_base_path = RunGit(['rev-parse', '--show-cdup']).strip() | 2318 rel_base_path = RunGit(['rev-parse', '--show-cdup']).strip() |
| 2319 if rel_base_path: | 2319 if rel_base_path: |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2437 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2437 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 2438 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2438 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
| 2439 | 2439 |
| 2440 | 2440 |
| 2441 if __name__ == '__main__': | 2441 if __name__ == '__main__': |
| 2442 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2442 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 2443 # unit testing. | 2443 # unit testing. |
| 2444 fix_encoding.fix_encoding() | 2444 fix_encoding.fix_encoding() |
| 2445 colorama.init() | 2445 colorama.init() |
| 2446 sys.exit(main(sys.argv[1:])) | 2446 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |