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

Side by Side Diff: git_cl.py

Issue 24217002: Add a flag for clang-format that instructs the tool to strip 0 leading slashes from the file names. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 7 years, 3 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 | « 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 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 print "Nothing to format." 2174 print "Nothing to format."
2175 return 0 2175 return 0
2176 RunCommand(['clang-format', '-i', '-style', 'Chromium'] + files, 2176 RunCommand(['clang-format', '-i', '-style', 'Chromium'] + files,
2177 cwd=top_dir) 2177 cwd=top_dir)
2178 else: 2178 else:
2179 # diff_output is a patch to send to clang-format-diff.py 2179 # diff_output is a patch to send to clang-format-diff.py
2180 cfd_path = os.path.join('/usr', 'lib', 'clang-format', 2180 cfd_path = os.path.join('/usr', 'lib', 'clang-format',
2181 'clang-format-diff.py') 2181 'clang-format-diff.py')
2182 if not os.path.exists(cfd_path): 2182 if not os.path.exists(cfd_path):
2183 DieWithError('Could not find clang-format-diff at %s.' % cfd_path) 2183 DieWithError('Could not find clang-format-diff at %s.' % cfd_path)
2184 cmd = [sys.executable, cfd_path, '-style', 'Chromium'] 2184 cmd = [sys.executable, cfd_path, '-p0', '-style', 'Chromium']
2185 RunCommand(cmd, stdin=diff_output, cwd=top_dir) 2185 RunCommand(cmd, stdin=diff_output, cwd=top_dir)
2186 2186
2187 return 0 2187 return 0
2188 2188
2189 2189
2190 class OptionParser(optparse.OptionParser): 2190 class OptionParser(optparse.OptionParser):
2191 """Creates the option parse and add --verbose support.""" 2191 """Creates the option parse and add --verbose support."""
2192 def __init__(self, *args, **kwargs): 2192 def __init__(self, *args, **kwargs):
2193 optparse.OptionParser.__init__( 2193 optparse.OptionParser.__init__(
2194 self, *args, prog='git cl', version=__version__, **kwargs) 2194 self, *args, prog='git cl', version=__version__, **kwargs)
(...skipping 30 matching lines...) Expand all
2225 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2225 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2226 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2226 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2227 2227
2228 2228
2229 if __name__ == '__main__': 2229 if __name__ == '__main__':
2230 # These affect sys.stdout so do it outside of main() to simplify mocks in 2230 # These affect sys.stdout so do it outside of main() to simplify mocks in
2231 # unit testing. 2231 # unit testing.
2232 fix_encoding.fix_encoding() 2232 fix_encoding.fix_encoding()
2233 colorama.init() 2233 colorama.init()
2234 sys.exit(main(sys.argv[1:])) 2234 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