Default on green (#78811)

Reopens https://github.com/pytorch/pytorch/pull/78771
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78811
Approved by: https://github.com/janeyx99
This commit is contained in:
zengk95
2022-06-03 18:04:27 +00:00
committed by PyTorch MergeBot
parent 86c42d63c8
commit c5a0d8dccc
2 changed files with 6 additions and 15 deletions

View File

@ -383,7 +383,6 @@ def parse_args() -> Any:
from argparse import ArgumentParser
parser = ArgumentParser("Merge PR into default branch")
parser.add_argument("--dry-run", action="store_true")
parser.add_argument("--on-green", action="store_true")
parser.add_argument("--revert", action="store_true")
parser.add_argument("--force", action="store_true")
parser.add_argument("--comment-id", type=int)
@ -890,7 +889,7 @@ def prefix_with_github_url(suffix_str: str) -> str:
return f"https://github.com/{suffix_str}"
def merge_on_green(pr_num: int, repo: GitRepo, dry_run: bool = False, timeout_minutes: int = 400) -> None:
def merge(pr_num: int, repo: GitRepo, dry_run: bool = False, timeout_minutes: int = 400) -> None:
repo = GitRepo(get_git_repo_dir(), get_git_remote_name())
org, project = repo.gh_owner_and_name()
start_time = time.time()
@ -945,16 +944,11 @@ def main() -> None:
gh_post_comment(org, project, args.pr_num, "Cross-repo ghstack merges are not supported", dry_run=args.dry_run)
return
if args.on_green:
try:
merge_on_green(args.pr_num, repo, dry_run=args.dry_run)
except Exception as e:
handle_exception(e)
else:
try:
pr.merge_into(repo, dry_run=args.dry_run, force=args.force, comment_id=args.comment_id)
except Exception as e:
handle_exception(e)
try:
merge(args.pr_num, repo, dry_run=args.dry_run)
except Exception as e:
handle_exception(e)
if __name__ == "__main__":