Skip to content

Commit

Permalink
Cherry-pick 275703@main (839318c). rdar://123852726
Browse files Browse the repository at this point in the history
    [git-webkit pr] Should prompt user if radar and bugs do not match
    https://bugs.webkit.org/show_bug.cgi?id=270314
    rdar://123852726

    Reviewed by Jonathan Bedard.

    Adds prompt for user to stop or continue the process when a radar and bug do not match.

    * Tools/Scripts/libraries/webkitbugspy/webkitbugspy/bugzilla.py:
    (Tracker.cc_radar): Will throw an exception if radar and bug do not match and user inputs No.
    * Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py:
    (PullRequest.create_pull_request): Catches the exception from cc_radar and halts.

    Canonical link: https://commits.webkit.org/275703@main

Canonical link: https://commits.webkit.org/272448.726@safari-7618-branch
  • Loading branch information
briannafan authored and JonWBedard committed Mar 14, 2024
1 parent 5db9b57 commit 98c7bab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Tools/Scripts/libraries/webkitbugspy/webkitbugspy/bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,11 @@ def cc_radar(self, issue, block=False, timeout=None, radar=None):
self.radar_importer.name,
issue.references[0] if issue.references else '?',
))
response = Terminal.choose(
'Double-check you have the correct bug. Would you like to continue?', options=('Yes', 'No'), default='Yes',
)
if response == 'No':
raise ValueError('Radar is tracking a different bug')

did_modify_cc = False
if user_to_cc or keyword_to_add:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,11 @@ def create_pull_request(cls, repository, args, branch_point, callback=None, unbl
not_radar = next(iter(filter(lambda issue: not isinstance(issue.tracker, radar.Tracker), issues)), None)
radar_cc_default = repository.config().get('webkitscmpy.cc-radar', 'true') == 'true'
if update_issue and radar_issue and not_radar and radar_issue.tracker.radarclient() and (args.cc_radar or (radar_cc_default and args.cc_radar is not False)):
not_radar.cc_radar(radar=radar_issue)
try:
not_radar.cc_radar(radar=radar_issue)
except ValueError:
sys.stderr.write('Aborting pull request.\n')
return 1

redaction_exemption = None
redacted_issue = None
Expand Down

0 comments on commit 98c7bab

Please sign in to comment.