[GH1] Enable cross-repo merges

GHStack based PRs still can not be cross-repo, but for regular ones
checkout `pull/{pr_no}/head`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/72750
This commit is contained in:
Nikita Shulga
2022-02-11 22:49:47 +00:00
committed by PyTorch MergeBot
parent 340fae4363
commit 0c95209fe7
2 changed files with 9 additions and 4 deletions

View File

@ -127,7 +127,10 @@ class GitRepo:
return self._run_git("symbolic-ref", "--short", "HEAD").strip()
def checkout(self, branch: str) -> None:
self._run_git('checkout', branch)
self._run_git("checkout", branch)
def fetch(self, ref: str, branch: str) -> None:
self._run_git("fetch", self.remote, f"{ref}:{branch}")
def show_ref(self, name: str) -> str:
refs = self._run_git('show-ref', '-s', name).strip().split('\n')