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

Unified Diff: gcl.py

Issue 4277003: Change gcl presubmit to only run commit hooks by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix unit test Created 10 years, 1 month 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 | tests/gcl_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gcl.py
diff --git a/gcl.py b/gcl.py
index 058837a1e631571c73be09e6f326e8f089410845..39f3bec1d4f8f06f2b5c069a6c0cb268eff10413 100755
--- a/gcl.py
+++ b/gcl.py
@@ -9,6 +9,7 @@ of files.
"""
import getpass
+import optparse
import os
import random
import re
@@ -865,22 +866,27 @@ def CMDupload(change_info, args):
return 0
-@need_change
-def CMDpresubmit(change_info):
+@need_change_and_args
+@attrs(usage='[--upload]')
+def CMDpresubmit(change_info, args):
"""Runs presubmit checks on the change.
The actual presubmit code is implemented in presubmit_support.py and looks
for PRESUBMIT.py files."""
if not change_info.GetFiles():
- print "Nothing to presubmit check, changelist is empty."
+ print('Nothing to presubmit check, changelist is empty.')
return 0
-
- print "*** Presubmit checks for UPLOAD would report: ***"
- result = DoPresubmitChecks(change_info, False, False)
-
- print "\n*** Presubmit checks for COMMIT would report: ***"
- result &= DoPresubmitChecks(change_info, True, False)
- return not result
+ parser = optparse.OptionParser()
+ parser.add_option('--upload', action='store_true')
+ options, args = parser.parse_args(args)
+ if args:
+ parser.error('Unrecognized args: %s' % args)
+ if options.upload:
+ print('*** Presubmit checks for UPLOAD would report: ***')
+ return not DoPresubmitChecks(change_info, False, False)
+ else:
+ print('*** Presubmit checks for COMMIT would report: ***')
+ return not DoPresubmitChecks(change_info, True, False)
def TryChange(change_info, args, swallow_exception):
« no previous file with comments | « no previous file | tests/gcl_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698