Skip to content

Updating existing merge request labels not working #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ddeno opened this issue Oct 21, 2015 · 1 comment
Closed

Updating existing merge request labels not working #76

ddeno opened this issue Oct 21, 2015 · 1 comment

Comments

@ddeno
Copy link

ddeno commented Oct 21, 2015

I am attempting to update an existing merge request's labels by removing one and adding another. After connecting to the Gitlab server, I am trying the following:

for p in gl.Project():
    if (p.id == json_project):
        for mr in p.MergeRequest():
            if (mr.id == json_mr):
                final_labels = []
                for label in mr.labels:
                    if (label not in attribs['remove']):
                        final_labels.append(label)
                for label in attribs['add']:
                    final_labels.append(u'%s' % (label))
                gl_mr.labels = final_labels
                gl_mr.save()

I am getting the error: GitlabUpdateError: 400: Source branch cannot be changed

Is this the proper way to update an existing merge request or am I doing something wrong?

@msylw
Copy link

msylw commented Apr 19, 2016

Got into same issue. Looks like it's a result of this change: https://gitlab.com/gitlab-org/gitlab-ce/commit/85145d1d77ed919949d59c83cccecd43789cc781
Now it's not legal to pass source_branch in update request to gitlab, but it's still passed on.
My workaround: call save like this:
mr.save(source_branch = None)
While it should be still illegal call, it passes and does not actually change the source branch.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants