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

Unified Diff: git_cl.py

Issue 10915072: add --force option for presubmit command (Closed) Base URL: https://git.chromium.org/chromium/tools/depot_tools.git@master
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | trychange.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index c8c3c8fad96c7556a2358f291265440d04cd7617..48fb848c8f20935b2ba81723818809ee35bebfab 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -926,13 +926,16 @@ def CMDpresubmit(parser, args):
"""run presubmit tests on the current changelist"""
parser.add_option('--upload', action='store_true',
help='Run upload hook instead of the push/dcommit hook')
+ parser.add_option('--force', action='store_true',
+ help='Run checks even if tree is dirty')
(options, args) = parser.parse_args(args)
# Make sure index is up-to-date before running diff-index.
RunGit(['update-index', '--refresh', '-q'], error_ok=True)
- if RunGit(['diff-index', 'HEAD']):
+ if not options.force and RunGit(['diff-index', 'HEAD']):
# TODO(maruel): Is this really necessary?
- print 'Cannot presubmit with a dirty tree. You must commit locally first.'
+ print ('Cannot presubmit with a dirty tree.\n'
+ 'You must commit locally first (or use --force).')
return 1
cl = Changelist()
« no previous file with comments | « no previous file | trychange.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698