[GHF] Retry push unconditionally (#77426)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77426
Approved by: https://github.com/seemethere
This commit is contained in:
Nikita Shulga
2022-05-13 17:09:01 +00:00
committed by PyTorch MergeBot
parent 3077e9059c
commit 2fc1725938

View File

@ -248,9 +248,7 @@ class GitRepo:
else:
self._run_git("push", self.remote, branch)
except RuntimeError as e:
# Check if push were rejected because branch is stale
if len(e.args) == 0 or re.search(r"\[rejected\].+\(fetch first\)\n", e.args[0]) is None:
raise
print(f"{cnt} push attempt failed with {e}")
self.fetch()
self._run_git("rebase", f"{self.remote}/{branch}")