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

Unified Diff: my_reviews.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_activity.py ('k') | presubmit_support.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: my_reviews.py
diff --git a/my_reviews.py b/my_reviews.py
index 6b36c5682cc7302cda6fbfe2dda667c384ea86c8..a26aa02a2e297351f1e6b196f33f7b5b22215775 100755
--- a/my_reviews.py
+++ b/my_reviews.py
@@ -14,6 +14,7 @@ import optparse
import os
import sys
+import auth
import rietveld
@@ -214,9 +215,10 @@ def print_issue(issue, reviewer, stats):
', '.join(sorted(issue['reviewers'])))
-def print_reviews(reviewer, created_after, created_before, instance_url):
+def print_reviews(
+ reviewer, created_after, created_before, instance_url, auth_config):
"""Prints issues |reviewer| received and potentially reviewed."""
- remote = rietveld.Rietveld(instance_url, None, None)
+ remote = rietveld.Rietveld(instance_url, auth_config)
# The stats we gather. Feel free to send me a CL to get more stats.
stats = Stats()
@@ -268,8 +270,9 @@ def print_reviews(reviewer, created_after, created_before, instance_url):
to_time(stats.median_latency))
-def print_count(reviewer, created_after, created_before, instance_url):
- remote = rietveld.Rietveld(instance_url, None, None)
+def print_count(
+ reviewer, created_after, created_before, instance_url, auth_config):
+ remote = rietveld.Rietveld(instance_url, auth_config)
print len(list(remote.search(
reviewer=reviewer,
created_after=created_after,
@@ -332,10 +335,12 @@ def main():
'-i', '--instance_url', metavar='<host>',
default='http://codereview.chromium.org',
help='Host to use, default is %default')
+ auth.add_auth_options(parser)
# Remove description formatting
parser.format_description = (
lambda _: parser.description) # pylint: disable=E1101
options, args = parser.parse_args()
+ auth_config = auth.extract_auth_config_from_options(options)
if args:
parser.error('Args unsupported')
if options.reviewer is None:
@@ -363,13 +368,15 @@ def main():
options.reviewer,
options.begin,
options.end,
- options.instance_url)
+ options.instance_url,
+ auth_config)
else:
print_reviews(
options.reviewer,
options.begin,
options.end,
- options.instance_url)
+ options.instance_url,
+ auth_config)
return 0
« no previous file with comments | « my_activity.py ('k') | presubmit_support.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698