mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-22 06:11:27 +08:00
[GHF] Add revert workflow
This adds `try_revert` repository dispatch that will revert commit that were previously landed by merge workflow if requested by org member Pull Request resolved: https://github.com/pytorch/pytorch/pull/71868
This commit is contained in:
committed by
PyTorch MergeBot
parent
5ee629e50d
commit
5bd33247ec
9
.github/scripts/gitutils.py
vendored
9
.github/scripts/gitutils.py
vendored
@ -140,12 +140,21 @@ class GitRepo:
|
||||
rc = _check_output(['sh', '-c', f'git -C {self.repo_dir} show {ref}|git patch-id --stable']).strip()
|
||||
return [cast(Tuple[str, str], x.split(" ", 1)) for x in rc.split("\n")]
|
||||
|
||||
def commits_resolving_gh_pr(self, pr_num: int) -> List[str]:
|
||||
owner, name = self.gh_owner_and_name()
|
||||
msg = f"Pull Request resolved: https://github.com/{owner}/{name}/pull/{pr_num}"
|
||||
rc = self._run_git('log', '--format=%H', '--grep', msg).strip()
|
||||
return rc.split("\n") if len(rc) > 0 else []
|
||||
|
||||
def get_commit(self, ref: str) -> GitCommit:
|
||||
return parse_fuller_format(self._run_git('show', '--format=fuller', '--date=unix', '--shortstat', ref))
|
||||
|
||||
def cherry_pick(self, ref: str) -> None:
|
||||
self._run_git('cherry-pick', '-x', ref)
|
||||
|
||||
def revert(self, ref: str) -> None:
|
||||
self._run_git("revert", "--no-edit", ref)
|
||||
|
||||
def compute_branch_diffs(self, from_branch: str, to_branch: str) -> Tuple[List[str], List[str]]:
|
||||
"""
|
||||
Returns list of commmits that are missing in each other branch since their merge base
|
||||
|
Reference in New Issue
Block a user