Add --force option for presubmit command which
allows one to run the presubmit script without
submitting locally (alternative would be to make
this a warning I guess).
Also, pass option.verbose through to DoGetTrySlaves()
so it will log which PRESUBMIT files are taking part
in the decision.
BUG=
Review URL: https://chromiumcodereview.appspot.com/10915072
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@154838 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cl.py b/git_cl.py
index c8c3c8f..48fb848 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -926,13 +926,16 @@
"""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()