8000 Merge pull request #902 from antonidabek/merge_title · shalevy1/github3.py@b699518 · GitHub
[go: up one dir, main page]

Skip to content

Commit b699518

Browse files
authored
Merge pull request sigmavirus24#902 from antonidabek/merge_title
Allow user to set up merge title
2 parents 49c0ae7 + 0e2751a commit b699518

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/github3/pulls.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,16 +477,24 @@ def issue_comments(self, number=-1, etag=None):
477477
return self._iter(int(number), url, IssueComment, etag=etag)
478478

479479
@requires_auth
480-
def merge(self, commit_message=None, sha=None, merge_method='merge'):
480+
def merge(self, commit_message=None, sha=None, merge_method='merge',
481+
commit_title=None):
481482
"""Merge this pull request.
482483
484+
.. versionchanged:: 1.3.0
485+
486+
The ``commit_title`` parameter has been added to allow users to
487+
set the merge commit title.
488+
483489
.. versionchanged:: 1.0.0
484490
485491
The boolean ``squash`` parameter has been replaced with
486492
``merge_method`` which requires a string.
487493
488494
:param str commit_message:
489495
(optional), message to be used for the merge commit
496+
:param str commit_title:
497+
(optional), message to be used for the merge commit title
490498
:param str sha:
491499
(optional), SHA that pull request head must match to merge.
492500
:param str merge_method: (optional), Change the merge method.
@@ -502,6 +510,8 @@ def merge(self, commit_message=None, sha=None, merge_method='merge'):
502510
parameters['sha'] = sha
503511
if commit_message is not None:
504512
parameters['commit_message'] = commit_message
513+
if commit_title is not None:
514+
parameters['commit_title'] = commit_title
505515
url = self._build_url('merge', base_url=self._api)
506516
json = self._json(self._put(url, data=dumps(parameters)), 200)
507517
if not json:

tests/unit/test_pulls.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ def test_merge_squash_message(self):
139139
data={"merge_method": "squash", "commit_message": "commit message"}
140140
)
141141

142+
def test_merge_with_custom_title(self):
143+
"""Show that user can merge a Pull Request with custom commit title"""
144+
self.instance.merge(commit_title='commit title')
145+
146+
self.put_called_with(
147+
url_for('merge'),
148+
data={"merge_method": "merge", "commit_title": "commit title"}
149+
)
150+
142151
def test_patch(self):
143152
"""Show that a user can fetch the patch from a Pull Request."""
144153
self.instance.patch()

0 commit comments

Comments
 (0)
0