开发者

Python-Gitlab: Wait until deleting a branch is completed

I'm havin开发者_如何学JAVAg an issue with Gitlab when deleting branches in Python. The problem is that Gitlab seems to be taking too long to complete the deletion, and I'm not sure why. I've created a brute-force code to try to reproduce the issue, it sometimes gets stuck in an endless loop, at least on my end.

If anyone has experienced this issue before or has any ideas on how to fix it, I'd really appreciate some help.

Thanks in advance!

for i in range(100):
    # (1) Start creating a new branch
    project.branches.create({'branch': 'head_branch','ref': 'main'})
    # (2) Wait until the new branch is created to move on.
    j = 0
    while 'head_branch' not in [branch.name for branch in project.branches.list(get_all=True)]:
        print(j)
        j +=1
    # (3) Delete the recently created branch
    deleted_branch = project.branches.delete('head_branch')
    # (4) Wait until the branch is deleted to move on.
    j = 0
    while 'head_branch' in [branch.name for branch in project.branches.list(get_all=True)]:
        print(j)
        j +=1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜