clang-format: Allow .proto files to be formatted (supported by an upcoming binary/script; this change is safe if you are running an older binary); remove warnings.

BUG=344916

Review URL: https://codereview.chromium.org/177213013

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@253295 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
nick@chromium.org
2014-02-25 23:57:03 +00:00
parent 36bc38406a
commit 8ca1aa3cd5
2 changed files with 3 additions and 23 deletions

View File

@@ -41,23 +41,7 @@ def FindClangFormatToolInChromiumTree():
gclient_utils.GetMacWinOrLinux(),
'clang-format' + gclient_utils.GetExeSuffix())
if not os.path.exists(tool_path):
# TODO(nick): After March 2014, eliminate the following advisory.
error_text = '''\n GIT CL FORMAT - WINTER WEATHER ADVISORY
clang-format binaries now come with every Chrome checkout!
Unfortunately, your depot_tools scripts tried to find clang-format binaries
in your Chrome checkout, but failed. This is expected if you haven't synced
since the binaries were added.
'git cl format' will probably not work until you sync your Chrome tree.
Sorry about that.
Contact nick@chromium.org if you have any additional questions.\n\n'''
error_text += 'File does not exist: %s' % tool_path
raise NotFoundError(error_text)
raise NotFoundError('File does not exist: %s' % tool_path)
return tool_path
@@ -66,11 +50,7 @@ def FindClangFormatScriptInChromiumTree(script_name):
script_path = os.path.join(_FindChromiumSourceRoot(), 'third_party',
'clang_format', 'script', script_name)
if not os.path.exists(script_path):
# TODO(thakis): Remove the fallback to the old location after a few weeks.
script_path = os.path.join(_FindChromiumSourceRoot(), 'third_party',
'clang_format', 'scripts', script_name)
if not os.path.exists(script_path):
raise NotFoundError('File does not exist: %s' % script_path)
raise NotFoundError('File does not exist: %s' % script_path)
return script_path

View File

@@ -2299,7 +2299,7 @@ def CMDowners(parser, args):
@subcommand.usage('[files or directories to diff]')
def CMDformat(parser, args):
"""Runs clang-format on the diff."""
CLANG_EXTS = ['.cc', '.cpp', '.h', '.mm']
CLANG_EXTS = ['.cc', '.cpp', '.h', '.mm', '.proto']
parser.add_option('--full', action='store_true',
help='Reformat the full content of all touched files')
parser.add_option('--dry-run', action='store_true',