Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0e2751a

Browse files
committed
Allow user to set up merge title
Github allows to setup custom title for commit that is used to mergepull requests.
1 parent49c0ae7 commit0e2751a

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
returnself._iter(int(number),url,IssueComment,etag=etag)
478478

479479
@requires_auth
480-
defmerge(self,commit_message=None,sha=None,merge_method='merge'):
480+
defmerge(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
ifcommit_messageisnotNone:
504512
parameters['commit_message']=commit_message
513+
ifcommit_titleisnotNone:
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
ifnotjson:

‎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+
deftest_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
deftest_patch(self):
143152
"""Show that a user can fetch the patch from a Pull Request."""
144153
self.instance.patch()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp