Skip to content

Commit

Permalink
feat: add ability to force bug confirmation (#19)
Browse files Browse the repository at this point in the history
* feat: add ability to force bug confirmation

* fix: disable auto-nag on bug confirmation
  • Loading branch information
pyoor committed Jul 30, 2021
1 parent 7f390d3 commit e641988
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
16 changes: 8 additions & 8 deletions bugmon/bugmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import logging
import os
import zipfile
from datetime import datetime as dt
from datetime import timedelta
from pathlib import Path
from typing import Optional, List, Dict, cast

Expand Down Expand Up @@ -147,10 +145,10 @@ def _confirm_open(self) -> None:
if "confirmed" not in self.bug.commands:
self.report(f"Verified bug as reproducible on {tip.build_str}.")
self._bisect(evaluator)
else:
change = dt.strptime(self.bug.last_change_time, "%Y-%m-%dT%H:%M:%SZ")
if dt.now() - timedelta(days=30) > change:
self.report(f"Bug remains reproducible on {tip.build_str}")
# else:
# change = dt.strptime(self.bug.last_change_time, "%Y-%m-%dT%H:%M:%SZ")
# if dt.now() - timedelta(days=30) > change:
# self.report(f"Bug remains reproducible on {tip.build_str}")
elif tip.status == EvaluatorResult.BUILD_PASSED:
bid = self.bug.initial_build_id
orig = self._reproduce_bug(evaluator, self.bug.branch, bid)
Expand Down Expand Up @@ -411,21 +409,23 @@ def detect_config(self) -> Optional[BaseEvaluatorConfig]:
self._close_bug = True
return None

def process(self) -> None:
def process(self, force_confirm: bool = False) -> None:
"""Process bugmon commands present in whiteboard
Available commands:
verify - Attempt to verify the bug state
bisect - Attempt to bisect the bug regression or, if RESOLVED, the bug fix
confirm - Attempt to confirm that testcase reproduces
:param force_confirm: Force confirmation regardless of bug state
"""
if not self.is_supported():
self.commit()
return

if self.needs_verify():
self._verify_fixed()
elif self.needs_confirm():
elif force_confirm or self.needs_confirm():
self._confirm_open()
elif self.needs_bisect():
self._bisect()
Expand Down
8 changes: 7 additions & 1 deletion bugmon/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def parse_args(argv: Any = None) -> argparse.Namespace:
action="store_true",
help="Disable bug modification",
)
parser.add_argument(
"-f",
"--force-confirm",
action="store_true",
help="Force bug confirmation regardless of status",
)

# Bug selection
bugs = parser.add_mutually_exclusive_group(required=True)
Expand Down Expand Up @@ -99,7 +105,7 @@ def main(argv: Optional[Dict[str, Any]] = None) -> int:
f"(Status: {bugmon.bug.status}, "
f"Resolution: {bugmon.bug.resolution})"
)
bugmon.process()
bugmon.process(args.force_confirm)
except BugmonException as e:
log.error(f"Error processing bug {bug.id}: {e}")
return 1
Expand Down

0 comments on commit e641988

Please sign in to comment.