MCPcopy Create free account
hub / github.com/apache/arrow / cli

Function cli

dev/merge_arrow_pr.py:594–636  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

592
593
594def 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
639if __name__ == '__main__':

Callers 1

merge_arrow_pr.pyFile · 0.85

Calls 9

showMethod · 0.95
continue_maybeMethod · 0.95
mergeMethod · 0.95
CommandInputClass · 0.85
get_pr_numFunction · 0.85
GitHubAPIClass · 0.85
PullRequestClass · 0.85
prompt_for_fix_versionFunction · 0.85
resolveMethod · 0.45

Tested by

no test coverage detected