add --only-tag option

The opposite of --ignore-tag, this filter requires repos to have all
of the specified tags.

Change-Id: Iacee6582e112d39734e2c428e97ff27acf4660ae
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-05-04 17:28:57 -04:00
parent 979d1c8239
commit b1848f2e8d

View File

@ -66,6 +66,14 @@ class ContributionsReportBase(lister.Lister):
help=('do not show stats for projects with the tag '
'(may be repeated)'),
)
parser.add_argument(
'--only-tag',
dest='only_tag',
default=[],
action='append',
help=('only show stats for projects with the tag '
'(may be repeated)'),
)
parser.add_argument(
'--ignore-single-vendor',
action='append_const',
@ -125,6 +133,17 @@ class ContributionsReportBase(lister.Lister):
ignore_tags)
)
only_tags = set(parsed_args.only_tag)
if only_tags:
team_data = governance.Governance(
url=parsed_args.governance_project_list)
data = (
d
for d in data
if only_tags.issubset(team_data.get_repo_tags(d['Project']))
)
if parsed_args.highlight_sponsors:
sponsor_map = sponsors.Sponsors(parsed_args.sponsor_level)