Skip to content

Commit 785562d

Browse files
shield007omgjlk
authored andcommitted
Fixed up the squash and merge support to match the git api. (sigmavirus24#768)
* Fixed up the squash and merge support to match the git api. The squash method has been removed and there is now a 'merge_method' parameter. See https://developer.github.com/changes/2017-04-07-end-merge-methods-api-preview/ for more details. * Fixed tests to align with changes in squash parameter
1 parent 552b18a commit 785562d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

github3/pulls.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,18 @@ def issue_comments(self, number=-1, etag=None):
303303
return self._iter(int(number), url, IssueComment, etag=etag)
304304

305305
@requires_auth
306-
def merge(self, commit_message=None, sha=None, squash=False):
306+
def merge(self, commit_message=None, sha=None, merge_method="merge"):
307307
"""Merge this pull request.
308308
309309
:param str commit_message: (optional), message to be used for the
310310
merge commit
311311
:param str sha: (optional), SHA that pull request head must match
312312
to merge.
313-
:param bool squash: (optional), commit a single commit to the
314-
head branch.
313+
:param str merge_method: (optional), Change the merge method.
314+
Either 'merge', 'squash' or 'rebase'. Default is 'merge'.
315315
:returns: bool
316316
"""
317-
parameters = {'squash': squash}
317+
parameters = {'merge_method': merge_method}
318318
if sha:
319319
parameters['sha'] = sha
320320
if commit_message is not None:

tests/unit/test_pulls.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,16 @@ def test_merge(self):
9999

100100
self.put_called_with(
101101
url_for('merge'),
102-
data={"squash": False}
102+
data={"merge_method": "merge"}
103103
)
104104

105105
def test_merge_squash_message(self):
106106
"""Show that a user can merge a Pull Request."""
107-
self.instance.merge('commit message', squash=True)
107+
self.instance.merge('commit message', merge_method='squash')
108108

109109
self.put_called_with(
110110
url_for('merge'),
111-
data={"squash": True, "commit_message": "commit message"}
111+
data={"merge_method": "squash", "commit_message": "commit message"}
112112
)
113113

114114
def test_patch(self):

0 commit comments

Comments
 (0)