Skip to content

Commit

Permalink
Merge pull request #785 from googlefonts/traffic-jam-filters
Browse files Browse the repository at this point in the history
manage-traffic-jam: add more filters
  • Loading branch information
m4rc1e authored Nov 3, 2023
2 parents 1fa448b + 05c4dd0 commit e64c8ac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
22 changes: 18 additions & 4 deletions Lib/gftools/scripts/manage_traffic_jam.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,15 @@ def main(args=None):
parser = argparse.ArgumentParser()
parser.add_argument("fonts_repo", type=Path)
parser.add_argument(
"-f", "--filter", choices=(None, "lists", "in_dev", "in_sandbox"), default=None
"-f", "--filter", choices=(
None,
"lists",
"in_dev",
"in_sandbox",
"upgrade",
"new",
"no_fonts",
), default=None, nargs="+",
)
parser.add_argument("-p", "--show-open-prs", action="store_true", default=False)
parser.add_argument(
Expand Down Expand Up @@ -222,7 +230,7 @@ def main(args=None):
push_items = PushItems.from_traffic_jam()
if not args.show_open_prs:
push_items = PushItems(i for i in push_items if i.merged == True)
if args.filter == "lists":
if "lists" in args.filter:
prod_path = args.fonts_repo / "to_production.txt"
production_file = PushItems.from_server_file(prod_path, PushStatus.IN_SANDBOX)

Expand All @@ -231,10 +239,16 @@ def main(args=None):

urls = [i.url for i in production_file + sandbox_file]
push_items = PushItems(i for i in push_items if i.url in urls)
elif args.filter == "in_dev":
if "in_dev" in args.filter:
push_items = push_items.in_dev()
elif args.filter == "in_sandbox":
if "in_sandbox" in args.filter:
push_items = push_items.in_sandbox()
if "upgrade" in args.filter:
push_items = PushItems(i for i in push_items if i.category == PushCategory.UPGRADE)
if "new" in args.filter:
push_items = PushItems(i for i in push_items if i.category == PushCategory.NEW)
if "no_fonts" in args.filter:
push_items = PushItems(i for i in push_items if i.category not in [PushCategory.NEW, PushCategory.UPGRADE])

with ItemChecker(push_items[::-1], args.fonts_repo, servers) as checker:
checker.run()
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ gftools-list-italicangle = "gftools.scripts.list_italicangle:main"
gftools-list-panose = "gftools.scripts.list_panose:main"
gftools-list-weightclass = "gftools.scripts.list_weightclass:main"
gftools-list-widthclass = "gftools.scripts.list_widthclass:main"
gftools-manage-traffic-jam = "gftools.scripts.manage_traffic_jam:main"
gftools-metadata-vs-api = "gftools.scripts.metadata_vs_api:main"
gftools-namelist = "gftools.scripts.namelist:main"
gftools-nametable-from-filename = "gftools.scripts.nametable_from_filename:main"
Expand Down

0 comments on commit e64c8ac

Please sign in to comment.