Skip to content

Commit

Permalink
gitlab: handle projects with disable MRs or issues
Browse files Browse the repository at this point in the history
Though the upstream API should just return an empty list.
  • Loading branch information
mathstuf committed Oct 27, 2015
1 parent 095ac8b commit 11ddf04
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bugwarrior/services/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,12 @@ def _fetch_paged(self, tmpl):
def get_repo_issues(self, rid):
tmpl = '{scheme}://{host}/api/v3/projects/%d/issues' % rid
issues = {}
for issue in self._fetch_paged(tmpl):
try:
repo_issues = self._fetch_paged(tmpl)
except:
# Projects may have issues disabled.
return []
for issue in repo_issues:
if issue['state'] != 'opened':
continue
issues[issue['id']] = (rid, issue)
Expand All @@ -330,7 +335,12 @@ def get_repo_issues(self, rid):
def get_repo_merge_requests(self, rid):
tmpl = '{scheme}://{host}/api/v3/projects/%d/merge_requests' % rid
issues = {}
for issue in self._fetch_paged(tmpl):
try:
repo_merge_requests = self._fetch_paged(tmpl)
except:
# Projects may have merge requests disabled.
return []
for issue in repo_merge_requests:
if issue['state'] != 'opened':
continue
issues[issue['id']] = (rid, issue)
Expand Down

0 comments on commit 11ddf04

Please sign in to comment.