diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2016-03-22 20:08:04 +0100 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2016-03-22 20:08:04 +0100 |
commit | 571a382f0595ea7cfd5424b1e4f5009fcb531642 (patch) | |
tree | a5b2197c941c949140e66521ba0bc914fdc5c942 | |
parent | f6a51d67c38c883775240d8c612d492bf023c2e4 (diff) | |
download | gitlab-571a382f0595ea7cfd5424b1e4f5009fcb531642.tar.gz |
MR: add support for closes_issues
-rw-r--r-- | gitlab/cli.py | 9 | ||||
-rw-r--r-- | gitlab/objects.py | 14 |
2 files changed, 23 insertions, 0 deletions
diff --git a/gitlab/cli.py b/gitlab/cli.py index efa2d76..cd64ada 100644 --- a/gitlab/cli.py +++ b/gitlab/cli.py @@ -42,6 +42,7 @@ EXTRA_ACTIONS = { 'filepath']}, 'builds': {'required': ['id', 'project-id']}}, gitlab.ProjectMergeRequest: { + 'closes-issues': {'required': ['id', 'project-id']}, 'cancel': {'required': ['id', 'project-id']}, 'merge': {'required': ['id', 'project-id'], 'optional': ['merge-commit-message', @@ -224,6 +225,14 @@ class GitlabCLI(object): except Exception as e: _die("Impossible to retry project build (%s)" % str(e)) + def do_project_merge_request_closesissues(self, cls, gl, what, args): + try: + o = self.do_get(cls, gl, what, args) + return o.closes_issues() + except Exception as e: + _die("Impossible to list issues closed by merge request (%s)" % + str(e)) + def do_project_merge_request_cancel(self, cls, gl, what, args): try: o = self.do_get(cls, gl, what, args) diff --git a/gitlab/objects.py b/gitlab/objects.py index 9ae9c50..9ce075a 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -1097,6 +1097,20 @@ class ProjectMergeRequest(GitlabObject): raise_error_from_response(r, errors) return ProjectMergeRequest(self, r.json()) + def closes_issues(self, **kwargs): + """List issues closed by the MR. + + Returns: + list (ProjectIssue): List of closed issues + + Raises: + GitlabConnectionError: If the server cannot be reached. + GitlabGetError: If the server fails to perform the request. + """ + url = ('/projects/%s/merge_requests/%s/closes_issues' % + (self.project_id, self.id)) + return self.gitlab._raw_list(url, ProjectIssue, **kwargs) + def merge(self, merge_commit_message=None, should_remove_source_branch=False, merged_when_build_succeeds=False, |