From 800129711d28549962e99dfa08007d9d79e4f7a3 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Sat, 23 Nov 2019 02:23:11 +0000 Subject: [PATCH] my_activity: allow to exclude some servers Not all my_activity.py users have accounts on all servers the utility queries. This results in access errors reported when the utility is ran. Also, many users never upload patches on some servers even though the account is there, there is no point in querying those servers. This patch allows to pass in a list of servers to exclude from the list of queried servers. BUG=none TEST=invoked the utility as follows: $ my_activity.py --skip_servers \ pdfium-review.googlesource.com,skia-review.googlesource.com observed that the 'ERROR:root:Access Errors:' messages are not generated any more. Change-Id: I7d676e45ee99d883a153b58acb778a2e2d5ed74a Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1487342 Reviewed-by: Aaron Gable --- my_activity.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/my_activity.py b/my_activity.py index 164ee504273af8..8e132f796847f8 100755 --- a/my_activity.py +++ b/my_activity.py @@ -168,6 +168,7 @@ def __init__(self, options): self.referenced_issues = [] self.google_code_auth_token = None self.access_errors = set() + self.skip_servers = (options.skip_servers.split(',')) def show_progress(self, how='.'): if sys.stdout.isatty(): @@ -216,6 +217,8 @@ def gerrit_changes_over_rest(self, instance, filters): return [] def gerrit_search(self, instance, owner=None, reviewer=None): + if instance['url'] in self.skip_servers: + return [] max_age = datetime.today() - self.modified_after filters = ['-age:%ss' % (max_age.days * 24 * 3600 + max_age.seconds)] if owner: @@ -724,6 +727,11 @@ def main(): help='Do not fetch issues referenced by owned changes. Useful in ' 'combination with --changes-by-issue when you only want to list ' 'issues that have also been modified in the same time period.') + parser.add_option( + '--skip_servers', + action='store', + default='', + help='A comma separated list of gerrit and rietveld servers to ignore') parser.add_option( '--skip-own-issues-without-changes', action='store_true',