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

Side by Side Diff: git_cl.py

Issue 293153004: Handle the case of git cl lint when the CL is empty. (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
Patch Set: Created 6 years, 7 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 | 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 import datetime 10 import datetime
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 return 1 1406 return 1
1407 1407
1408 # Change the current working directory before calling lint so that it 1408 # Change the current working directory before calling lint so that it
1409 # shows the correct base. 1409 # shows the correct base.
1410 previous_cwd = os.getcwd() 1410 previous_cwd = os.getcwd()
1411 os.chdir(settings.GetRoot()) 1411 os.chdir(settings.GetRoot())
1412 try: 1412 try:
1413 cl = Changelist() 1413 cl = Changelist()
1414 change = cl.GetChange(cl.GetCommonAncestorWithUpstream(), None) 1414 change = cl.GetChange(cl.GetCommonAncestorWithUpstream(), None)
1415 files = [f.LocalPath() for f in change.AffectedFiles()] 1415 files = [f.LocalPath() for f in change.AffectedFiles()]
1416 if not files:
1417 print "Cannot lint an empty CL"
1418 return 1
1416 1419
1417 # Process cpplints arguments if any. 1420 # Process cpplints arguments if any.
1418 command = args + files 1421 command = args + files
1419 if options.filter: 1422 if options.filter:
1420 command = ['--filter=' + ','.join(options.filter)] + command 1423 command = ['--filter=' + ','.join(options.filter)] + command
1421 filenames = cpplint.ParseArguments(command) 1424 filenames = cpplint.ParseArguments(command)
1422 1425
1423 white_regex = re.compile(settings.GetLintRegex()) 1426 white_regex = re.compile(settings.GetLintRegex())
1424 black_regex = re.compile(settings.GetLintIgnoreRegex()) 1427 black_regex = re.compile(settings.GetLintIgnoreRegex())
1425 extra_check_functions = [cpplint_chromium.CheckPointerDeclarationWhitespace] 1428 extra_check_functions = [cpplint_chromium.CheckPointerDeclarationWhitespace]
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2603 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2601 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2604 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2602 2605
2603 2606
2604 if __name__ == '__main__': 2607 if __name__ == '__main__':
2605 # These affect sys.stdout so do it outside of main() to simplify mocks in 2608 # These affect sys.stdout so do it outside of main() to simplify mocks in
2606 # unit testing. 2609 # unit testing.
2607 fix_encoding.fix_encoding() 2610 fix_encoding.fix_encoding()
2608 colorama.init() 2611 colorama.init()
2609 sys.exit(main(sys.argv[1:])) 2612 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