Skip to content

Commit

Permalink
my_activity: allow to exclude some servers
Browse files Browse the repository at this point in the history
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 <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1487342
Reviewed-by: Aaron Gable <agable@chromium.org>
  • Loading branch information
Vadim Bendebury authored and Commit Bot committed Nov 23, 2019
1 parent 556c0a2 commit 8001297
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions my_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 8001297

Please sign in to comment.