Revert "Default on green (#78811)"

This reverts commit c5a0d8dccc63e85ab6590564264b6bb5de43b860.

Reverted https://github.com/pytorch/pytorch/pull/78811 on behalf of https://github.com/zengk95 due to This does not have force in there
This commit is contained in:
PyTorch MergeBot
2022-06-06 17:27:54 +00:00
parent 9fca008809
commit f2b56dd6ee
2 changed files with 15 additions and 6 deletions

View File

@ -383,6 +383,7 @@ 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)
@ -889,7 +890,7 @@ def prefix_with_github_url(suffix_str: str) -> str:
return f"https://github.com/{suffix_str}"
def merge(pr_num: int, repo: GitRepo, dry_run: bool = False, timeout_minutes: int = 400) -> None:
def merge_on_green(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()
@ -948,11 +949,16 @@ def main() -> None:
gh_post_comment(org, project, args.pr_num, "Cross-repo ghstack merges are not supported", dry_run=args.dry_run)
return
try:
merge(args.pr_num, repo, dry_run=args.dry_run)
except Exception as e:
handle_exception(e)
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)
if __name__ == "__main__":