Skip to content

Commit

Permalink
fix: return response with commit data
Browse files Browse the repository at this point in the history
  • Loading branch information
nejch committed Feb 18, 2020
1 parent ad3e833 commit b77b945
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 4 additions & 1 deletion gitlab/v4/objects.py
Expand Up @@ -2148,10 +2148,13 @@ def revert(self, branch, **kwargs):
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabRevertError: If the revert could not be performed
Returns:
dict: The new commit data (*not* a RESTObject)
"""
path = "%s/%s/revert" % (self.manager.path, self.get_id())
post_data = {"branch": branch}
self.manager.gitlab.http_post(path, post_data=post_data, **kwargs)
return self.manager.gitlab.http_post(path, post_data=post_data, **kwargs)


class ProjectCommitManager(RetrieveMixin, CreateMixin, RESTManager):
Expand Down
5 changes: 2 additions & 3 deletions tools/python_test_v4.py
Expand Up @@ -463,13 +463,12 @@
# assert len(discussion.attributes["notes"]) == 1

# Revert commit
commit.revert(branch="master")
revert_commit = admin_project.commits.list()[0]
revert_commit = commit.revert(branch="master")

expected_message = 'Revert "{}"\n\nThis reverts commit {}'.format(
commit.message, commit.id
)
assert revert_commit.message == expected_message
assert revert_commit["message"] == expected_message

try:
commit.revert(branch="master")
Expand Down

0 comments on commit b77b945

Please sign in to comment.