diff --git a/swh-team/swh-weekly-report b/swh-team/swh-weekly-report index 10b53e1..ec8f64d 100755 --- a/swh-team/swh-weekly-report +++ b/swh-team/swh-weekly-report @@ -9,7 +9,7 @@ from dateutil.relativedelta import relativedelta from phabricator import Phabricator from swhphab import paginate, whoami -from swhphab import print_commits, print_tasks, print_reviews +from swhphab import print_commits, print_tasks, print_diffs def list_tasks(phab, newer_than): @@ -38,7 +38,18 @@ def list_commits(phab, newer_than): lambda c: c['fields']['committer']['epoch'] <= newer_than) -def list_reviews(phab, newer_than): +def list_authored_diffs(phab, newer_than): + + def recent(c): return c['fields']['dateModified'] <= newer_than + + authored = list(paginate(phab.differential.revision.search, + {'queryKey': 'authored', 'order': 'updated'}, + recent)) + + return authored + + +def list_subscribed_diffs(phab, newer_than): def recent(c): return c['fields']['dateModified'] <= newer_than @@ -50,7 +61,7 @@ def list_reviews(phab, newer_than): 'order': 'updated'}, recent)) - return authored + [r for r in subscribed if r not in authored] + return [r for r in subscribed if r not in authored] @click.command() @@ -60,9 +71,9 @@ def list_reviews(phab, newer_than): help='list tasks') @click.option('--commits/--no-commits', default=True, show_default=True, help='list commits') -@click.option('--reviews/--no-reviews', default=True, show_default=True, - help='list reviews') -def main(days, tasks, commits, reviews): +@click.option('--diffs/--no-diffs', default=True, show_default=True, + help='list diffs') +def main(days, tasks, commits, diffs): phab = Phabricator() phab.update_interfaces() @@ -78,9 +89,12 @@ def main(days, tasks, commits, reviews): print('Commits (authored):') print_commits(phab, list_commits(phab, **query)) print() - if reviews: - print('Reviews (authored & subscribed):') - print_reviews(phab, list_reviews(phab, **query)) + if diffs: + print('Diffs (authored):') + print_diffs(phab, list_authored_diffs(phab, **query)) + print() + print('Diffs (subscribed):') + print_diffs(phab, list_subscribed_diffs(phab, **query)) print() diff --git a/swh-team/swhphab.py b/swh-team/swhphab.py index bc91b35..98360a7 100644 --- a/swh-team/swhphab.py +++ b/swh-team/swhphab.py @@ -79,7 +79,7 @@ def print_commits(phab, commits): msg=c['fields']['message'].split('\n')[0])) -def print_reviews(phab, reviews): +def print_diffs(phab, reviews): """print a list of Phabricator diffs, with some context Args: @@ -88,7 +88,7 @@ def print_reviews(phab, reviews): """ for r in reviews: repo = lookup_repo(phab, r['fields']['repositoryPHID']) - print('- D{id} | {repo} | {title}'.format( + print('- https://forge.softwareheritage.org/D{id} | {repo} | {title}'.format( id=r['id'], repo=pp_repo(repo), title=r['fields']['title']))