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

Side by Side Diff: git_cl.py

Issue 788933003: Let `git cl format` format java files, too. (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 2751 matching lines...) Expand 10 before | Expand all | Expand 10 after
2762 [f.LocalPath() for f in 2762 [f.LocalPath() for f in
2763 cl.GetChange(base_branch, None).AffectedFiles()], 2763 cl.GetChange(base_branch, None).AffectedFiles()],
2764 change.RepositoryRoot(), author, 2764 change.RepositoryRoot(), author,
2765 fopen=file, os_path=os.path, glob=glob.glob, 2765 fopen=file, os_path=os.path, glob=glob.glob,
2766 disable_color=options.no_color).run() 2766 disable_color=options.no_color).run()
2767 2767
2768 2768
2769 @subcommand.usage('[files or directories to diff]') 2769 @subcommand.usage('[files or directories to diff]')
2770 def CMDformat(parser, args): 2770 def CMDformat(parser, args):
2771 """Runs clang-format on the diff.""" 2771 """Runs clang-format on the diff."""
2772 CLANG_EXTS = ['.cc', '.cpp', '.h', '.mm', '.proto'] 2772 CLANG_EXTS = ['.cc', '.cpp', '.h', '.mm', '.proto', '.java']
M-A Ruel 2014/12/09 21:15:45 A careful reader will note that the list was sorte
Nico 2014/12/09 21:17:44 It’s not sorted, it’s grouped by language. See the
M-A Ruel 2014/12/09 21:18:35 "..." lgtm
2773 parser.add_option('--full', action='store_true', 2773 parser.add_option('--full', action='store_true',
2774 help='Reformat the full content of all touched files') 2774 help='Reformat the full content of all touched files')
2775 parser.add_option('--dry-run', action='store_true', 2775 parser.add_option('--dry-run', action='store_true',
2776 help='Don\'t modify any file on disk.') 2776 help='Don\'t modify any file on disk.')
2777 parser.add_option('--diff', action='store_true', 2777 parser.add_option('--diff', action='store_true',
2778 help='Print diff to stdout rather than modifying files.') 2778 help='Print diff to stdout rather than modifying files.')
2779 opts, args = parser.parse_args(args) 2779 opts, args = parser.parse_args(args)
2780 2780
2781 # git diff generates paths against the root of the repository. Change 2781 # git diff generates paths against the root of the repository. Change
2782 # to that directory so clang-format can find files even within subdirs. 2782 # to that directory so clang-format can find files even within subdirs.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2916 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2916 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2917 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2917 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2918 2918
2919 2919
2920 if __name__ == '__main__': 2920 if __name__ == '__main__':
2921 # These affect sys.stdout so do it outside of main() to simplify mocks in 2921 # These affect sys.stdout so do it outside of main() to simplify mocks in
2922 # unit testing. 2922 # unit testing.
2923 fix_encoding.fix_encoding() 2923 fix_encoding.fix_encoding()
2924 colorama.init() 2924 colorama.init()
2925 sys.exit(main(sys.argv[1:])) 2925 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698