Skip to content

Commit

Permalink
[FIX] otools-pending show: properly filter merged states
Browse files Browse the repository at this point in the history
  • Loading branch information
ivantodorovich authored and gurneyalex committed Jan 10, 2025
1 parent 8dc4365 commit 94c6198
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions odoo_tools/cli/pending.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ def cli():
"-s",
"--state",
"state",
help="only list pull requests in the specified state (open, merged, closed)",
) # TODO list valid values
help="only list pull requests in the specified state",
type=click.Choice(["open", "merged", "closed"], case_sensitive=False),
)
@click.option(
"-p",
"--purge",
Expand Down
9 changes: 7 additions & 2 deletions odoo_tools/utils/pending_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,13 @@ def show_prs(self, state=None, purge=None):
ui.echo(f"Merge file: {self.merges_path}")
all_prs = aggregator.collect_prs_info()
if state is not None:
# filter only our state
all_prs = {k: v for k, v in all_prs.items() if k == state}
if state == "merged":
all_prs = {"closed": all_prs.get("closed", [])}
all_prs["closed"] = [
pr for pr in all_prs["closed"] if pr.get("merged") == "merged"
]
else:
all_prs = {k: v for k, v in all_prs.items() if k == state}
for pr_state, prs in all_prs.items():
ui.echo(f"State: {pr_state}")
for i, pr_info in enumerate(prs, 1):
Expand Down

0 comments on commit 94c6198

Please sign in to comment.