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

Unified Diff: presubmit_support.py

Issue 1075723002: Extract authentication options handling into a separate function. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 8 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 | « my_reviews.py ('k') | rietveld.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_support.py
diff --git a/presubmit_support.py b/presubmit_support.py
index a95b9adf6efa5efad34d68360845545cb8b34ddc..0abd4219102d630e55fcf0959c73dc8cf5193ad3 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -39,6 +39,7 @@ import urllib2 # Exposed through the API.
from warnings import warn
# Local imports.
+import auth
import fix_encoding
import gclient_utils
import owners
@@ -1637,7 +1638,6 @@ def main(argv=None):
"to skip multiple canned checks.")
parser.add_option("--rietveld_url", help=optparse.SUPPRESS_HELP)
parser.add_option("--rietveld_email", help=optparse.SUPPRESS_HELP)
- parser.add_option("--rietveld_password", help=optparse.SUPPRESS_HELP)
parser.add_option("--rietveld_fetch", action='store_true', default=False,
help=optparse.SUPPRESS_HELP)
# These are for OAuth2 authentication for bots. See also apply_issue.py
@@ -1646,7 +1646,9 @@ def main(argv=None):
parser.add_option("--trybot-json",
help="Output trybot information to the file specified.")
+ auth.add_auth_options(parser)
options, args = parser.parse_args(argv)
+ auth_config = auth.extract_auth_config_from_options(options)
if options.verbose >= 2:
logging.basicConfig(level=logging.DEBUG)
@@ -1658,9 +1660,6 @@ def main(argv=None):
if options.rietveld_email and options.rietveld_email_file:
parser.error("Only one of --rietveld_email or --rietveld_email_file "
"can be passed to this program.")
- if options.rietveld_private_key_file and options.rietveld_password:
- parser.error("Only one of --rietveld_private_key_file or "
- "--rietveld_password can be passed to this program.")
if options.rietveld_email_file:
with open(options.rietveld_email_file, "rb") as f:
@@ -1682,8 +1681,8 @@ def main(argv=None):
else:
rietveld_obj = rietveld.CachingRietveld(
options.rietveld_url,
- options.rietveld_email,
- options.rietveld_password)
+ auth_config,
+ options.rietveld_email)
if options.rietveld_fetch:
assert options.issue
props = rietveld_obj.get_issue_properties(options.issue, False)
« no previous file with comments | « my_reviews.py ('k') | rietveld.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698