Skip to content

Commit

Permalink
fix: check that command exists before adding or removing it
Browse files Browse the repository at this point in the history
  • Loading branch information
pyoor committed Feb 21, 2023
1 parent 962eb5c commit 17ee883
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions bugmon/bugmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,17 @@ def _bisect(
find_fix,
)
except FetcherException as e:
self.add_command("bisected")
if "bisected" not in self.bug.commands:
self.add_command("bisected")

self.report(f"Unable to bisect testcase ({str(e).lower()})")
return None

result = bisector.bisect()

# Set bisected status and remove the bisect command
self.add_command("bisected")
if "bisected" not in self.bug.commands:
self.add_command("bisected")
if "bisect" in self.bug.commands:
self.remove_command("bisect")

Expand Down Expand Up @@ -218,7 +221,8 @@ def _confirm_open(self) -> None:
self._close_bug = True

# Set confirmed status and remove the confirm command
self.add_command("confirmed")
if "confirmed" not in self.bug.commands:
self.add_command("confirmed")
if "confirm" in self.bug.commands:
self.remove_command("confirm")

Expand Down Expand Up @@ -292,7 +296,8 @@ def _pernosco(self) -> None:
elif isinstance(config.evaluator, JSEvaluator):
self.report("Pernosco sessions are only supported for Firefox bugs!")

self.remove_command("pernosco")
if "pernosco" in self.bug.commands:
self.remove_command("pernosco")

return None

Expand Down Expand Up @@ -343,7 +348,8 @@ def _verify_fixed(self) -> None:
+ "keyword to prevent further analysis."
)
self.bug.status = "REOPENED"
self.add_command("confirmed")
if "confirmed" not in self.bug.commands:
self.add_command("confirmed")

branches_verified = True
for alias, rel_num in self.bug.branches.items():
Expand Down

0 comments on commit 17ee883

Please sign in to comment.