[PATCH] D126940: github: Fix release automation /branch command with new repo

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 18:29:01 PDT 2022


tstellar added inline comments.


================
Comment at: llvm/utils/git/github-automation.py:322
+            local_repo = Repo(self.llvm_project_dir)
+            local_repo.git.fetch(f'https://github.com/{owner}/llvm-project', f'{branch}:{branch}')
+            local_repo.git.push(self.push_url, f'{branch}:{branch}', force=True)
----------------
thieta wrote:
> tstellar wrote:
> > thieta wrote:
> > > Maybe there should be some error handling here? this block can be retried if fetch or push fails - network errors happens fairly often.
> > Is there a concise way to do retries in python?  I tried implementing this, but I thought it made the script too complicated.  
> maybe:
> 
> ```
> for i in range(5):
>   try:
>     local_repo.git.fetch(...)
>     local_repo.git.push(...)
>   except:
>     continue
> ```
> 
> Or use https://pypi.org/project/retrying/ which is very nice and looks much neater in the code.
That module looks nice, but I didn't want to add another dependency, so I just implemented the retry manually.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126940/new/

https://reviews.llvm.org/D126940



More information about the llvm-commits mailing list