Skip to content
Snippets Groups Projects
Commit 669e2c79 authored by ale's avatar ale
Browse files

Catch errors when listing branches

For projects that do not have an associated repository.
parent 7b79c9d1
No related branches found
No related tags found
No related merge requests found
import logging
import re
......@@ -18,6 +19,7 @@ def list_projects(gl, search_pattern):
search_namespaces=True,
as_list=False,
simple=True,
archived=False,
)
for p in projects:
yield p.path_with_namespace
......@@ -26,7 +28,13 @@ def list_projects(gl, search_pattern):
def get_branches(gl, project_names):
for path_with_namespace in project_names:
p = gl.projects.get(path_with_namespace)
for b in p.branches.list():
try:
branches = p.branches.list()
except Exception as e:
logging.error('error getting branches for %s: %s',
path_with_namespace, e)
continue
for b in branches:
yield (path_with_namespace, b.name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment