[sysadmin-bin] Use Project as GroupProject does not expose all methods



commit ed8248e2761346bae633b81686a42291f80eb924
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Fri Sep 27 16:23:21 2019 +0200

    Use Project as GroupProject does not expose all methods

 gitlab/gitlab-operations.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gitlab/gitlab-operations.py b/gitlab/gitlab-operations.py
index ed0070f..b15dab8 100755
--- a/gitlab/gitlab-operations.py
+++ b/gitlab/gitlab-operations.py
@@ -99,13 +99,14 @@ for project in projects:
     if not default_branch:
         default_branch = 'master'
 
-    branches = [branch.name for branch in project.branches.list()]
+    proj = gl.projects.get(project.id, lazy=True)
+    branches = [branch.name for branch in proj.branches.list()]
     stable_branches_regex = re.compile(r'gnome-\d-\d\d')
     stable_branches = set(filter(stable_branches_regex.match, branches))
-    protected_branches = {branch.name for branch in project.protectedbranches.list()}
+    protected_branches = {branch.name for branch in proj.protectedbranches.list()}
 
     for branch_name in (stable_branches - protected_branches):
-        branch = project.branches.get(branch_name, lazy=True)
+        branch = proj.branches.get(branch_name, lazy=True)
         branch.protect(developers_can_push=True, developers_can_merge=True)
 
     try:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]