()
| 592 | |
| 593 | |
| 594 | def cli(): |
| 595 | # Location of your Arrow git clone |
| 596 | ARROW_HOME = os.path.abspath(os.path.dirname(__file__)) |
| 597 | print(f"ARROW_HOME = {ARROW_HOME}") |
| 598 | print(f"ORG_NAME = {ORG_NAME}") |
| 599 | print(f"PROJECT_NAME = {PROJECT_NAME}") |
| 600 | |
| 601 | cmd = CommandInput() |
| 602 | |
| 603 | pr_num = get_pr_num() |
| 604 | |
| 605 | os.chdir(ARROW_HOME) |
| 606 | |
| 607 | github_api = GitHubAPI(PROJECT_NAME, cmd) |
| 608 | pr = PullRequest(cmd, github_api, ORG_NAME, pr_num) |
| 609 | |
| 610 | if pr.is_merged: |
| 611 | print("Pull request %s has already been merged" % pr_num) |
| 612 | sys.exit(0) |
| 613 | |
| 614 | if not pr.is_mergeable: |
| 615 | print("Pull request %s is not mergeable in its current form" % pr_num) |
| 616 | sys.exit(1) |
| 617 | |
| 618 | pr.show() |
| 619 | |
| 620 | cmd.continue_maybe("Proceed with merging pull request #%s?" % pr_num) |
| 621 | |
| 622 | pr.merge() |
| 623 | |
| 624 | if pr.issue is None: |
| 625 | print("Minor PR. No issue to update.\n") |
| 626 | return |
| 627 | |
| 628 | cmd.continue_maybe("Would you like to update the associated issue?") |
| 629 | issue_comment = ( |
| 630 | "Issue resolved by pull request %s\n%s" |
| 631 | % (pr_num, |
| 632 | f"https://github.com/{ORG_NAME}/{PROJECT_NAME}/pull/{pr_num}") |
| 633 | ) |
| 634 | fix_version = prompt_for_fix_version(cmd, pr.issue, |
| 635 | pr.maintenance_branches) |
| 636 | pr.issue.resolve(fix_version, issue_comment, pr.body) |
| 637 | |
| 638 | |
| 639 | if __name__ == '__main__': |
no test coverage detected