Skip to content

Finding closes_issues() for merge_request give 404 #160

Description

@kvdveer

My example code:

x = project.mergerequests.get(iid=184)
# "GET /api/v3/projects/68/merge_requests?iid=184&project_id=68 HTTP/1.1" 200 998

print(x.closes_issues())
# "GET /api/v3/projects/68/merge_requests/None/closes_issues?project_id=68 HTTP/1.1" 404 27

print(x.as_dict() )
#{'gitlab': <gitlab.Gitlab at 0x7f383c31da90>,
# 'id': None,
# 'iid': 184,
# 'project_id': 68}

As you can see, the url is constructed incorrectly (None instead of the merge request iid). This is probably because the id of the MR is not filled in.

Oddly enough, this works fine when the MR is retrieved using the list method:

 project.mergerequests.list(iid=184)[0].as_dict()
# {'assignee': None,
#  'author': <gitlab.objects.User at 0x7f3836f757b8>,
#  'created_at': '2016-10-03T03:55:09.473+02:00',
#  'description': '<redacted>',
#  'downvotes': 0,
#  'force_remove_source_branch': False,
#  'gitlab': <gitlab.Gitlab at 0x7f383c31da90>,
#  'id': 186,
#  'iid': 184,
#  'labels': [],
#  'merge_commit_sha': None,
#  'merge_status': 'can_be_merged',
#  'merge_when_build_succeeds': False,
#  'milestone': None,
#  'project_id': 68,
#  'sha': '51ceba81898eef854d2929805771cdcb61e1e132',
#  'should_remove_source_branch': False,
#  'source_branch': 'show_version',
#  'source_project_id': 68,
#  'state': 'opened',
#  'subscribed': True,
#  'target_branch': 'master',
#  'target_project_id': 68,
#  'title': '<redacted>',
#  'updated_at': '2016-10-03T04:30:46.671+02:00',
#  'upvotes': 0,
#  'user_notes_count': 0,
#  'web_url': '<redacted>/merge_requests/184',
#  'work_in_progress': False}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions