Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: git_cl.py

Issue 177213013: clang-format: Allow .proto files to be formatted; remove warnings. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: More cleanup. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « clang_format.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2281 matching lines...) Expand 10 before | Expand all | Expand 10 after
2292 [f.LocalPath() for f in 2292 [f.LocalPath() for f in
2293 cl.GetChange(base_branch, None).AffectedFiles()], 2293 cl.GetChange(base_branch, None).AffectedFiles()],
2294 change.RepositoryRoot(), author, 2294 change.RepositoryRoot(), author,
2295 fopen=file, os_path=os.path, glob=glob.glob, 2295 fopen=file, os_path=os.path, glob=glob.glob,
2296 disable_color=options.no_color).run() 2296 disable_color=options.no_color).run()
2297 2297
2298 2298
2299 @subcommand.usage('[files or directories to diff]') 2299 @subcommand.usage('[files or directories to diff]')
2300 def CMDformat(parser, args): 2300 def CMDformat(parser, args):
2301 """Runs clang-format on the diff.""" 2301 """Runs clang-format on the diff."""
2302 CLANG_EXTS = ['.cc', '.cpp', '.h', '.mm'] 2302 CLANG_EXTS = ['.cc', '.cpp', '.h', '.mm', '.proto']
2303 parser.add_option('--full', action='store_true', 2303 parser.add_option('--full', action='store_true',
2304 help='Reformat the full content of all touched files') 2304 help='Reformat the full content of all touched files')
2305 parser.add_option('--dry-run', action='store_true', 2305 parser.add_option('--dry-run', action='store_true',
2306 help='Don\'t modify any file on disk.') 2306 help='Don\'t modify any file on disk.')
2307 opts, args = parser.parse_args(args) 2307 opts, args = parser.parse_args(args)
2308 2308
2309 # git diff generates paths against the root of the repository. Change 2309 # git diff generates paths against the root of the repository. Change
2310 # to that directory so clang-format can find files even within subdirs. 2310 # to that directory so clang-format can find files even within subdirs.
2311 rel_base_path = settings.GetRelativeRoot() 2311 rel_base_path = settings.GetRelativeRoot()
2312 if rel_base_path: 2312 if rel_base_path:
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2430 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2431 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2431 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2432 2432
2433 2433
2434 if __name__ == '__main__': 2434 if __name__ == '__main__':
2435 # These affect sys.stdout so do it outside of main() to simplify mocks in 2435 # These affect sys.stdout so do it outside of main() to simplify mocks in
2436 # unit testing. 2436 # unit testing.
2437 fix_encoding.fix_encoding() 2437 fix_encoding.fix_encoding()
2438 colorama.init() 2438 colorama.init()
2439 sys.exit(main(sys.argv[1:])) 2439 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « clang_format.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698