Skip to content

Fix should_remove_source_branch #186

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

Merged

Conversation

petebrowne
Copy link
Contributor

I'm getting the following 400 error when using merge:

  File "/usr/local/lib/python2.7/site-packages/gitlab/objects.py", line 1533, in merge
    raise_error_from_response(r, errors)
  File "/usr/local/lib/python2.7/site-packages/gitlab/exceptions.py", line 168, in raise_error_from_response
    response_body=response.content)
gitlab.exceptions.GitlabOperationError: 400: {"error":"should_remove_source_branch is invalid"}

It seems like Gitlab has changed their validations - using True seems to work.

@gpocentek
Copy link
Contributor

@petebrowne Thank you for your patch!

The problem I see here is that this code will fail for users dealing with older gitlab installations. That type of change shouldn't append on the gitlab side but we'll have to deal with it.

I don't have a solution to offer. Maybe check the version before deciding what to do with this attribute?

@petebrowne
Copy link
Contributor Author

How do we check the Gitlab version? Is that an API call we need to make? Or is that configuration for the end user of this client?

Taking a step back - why was this set to "should_remove_source_branch" in the first place? It seems very odd that the API wouldn't accept true. Which versions of the Gitlab API required this?

@gpocentek
Copy link
Contributor

I honestly don't remember if I had to use this value or if any value would have worked. I'll test on an older gitlab version to make sure switching to true works.

@gpocentek
Copy link
Contributor

Current code doesn't seem correct. Let's merge, thank you!

@gpocentek gpocentek merged commit 39288c8 into python-gitlab:master Dec 2, 2016
@petebrowne petebrowne deleted the fix-should-remove-source-branch branch December 2, 2016 22:13
@petebrowne
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants