Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f23e871

Browse files
authoredSep 17, 2021
Merge pull request sigmavirus24#1035 from Fedosin/maintainer_can_modify
Add maintainer_can_modify parameter to create_pull
2 parents 9345f86 + 0267337 commit f23e871

File tree

9 files changed

+35
-7
lines changed

9 files changed

+35
-7
lines changed
 

‎docs/bin/lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
2-
output="$(find docs/source -name '*.rst' | xargs proselint)"
2+
output="$(find docs/source -name '*.rst' | grep -v docs/source/examples/octocat.rst | xargs proselint)"
33
exit_code=$?
44

55
if echo "$output" | grep -qve 'typography' ; then

‎docs/source/contributing/testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ started when you write
229229
.. code:: python
230230
231231
with self.recorder.use_cassette(cassette_name):
232-
# ...
232+
#
233233
234234
Everything that talks to GitHub should be written inside of the context
235235
created by the context manager there. No requests to GitHub should be made

‎docs/source/examples/gist.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Creating an anonymous gist
5555
print(gist.html_url)
5656

5757
In the above examples ``'spam.txt'`` is the file name. GitHub will autodetect
58-
file type based on extension provided. ``'What... is the air-speed velocity of
58+
file type based on extension provided. ``'What is the air-speed velocity of
5959
an unladen swallow?'`` is the file's content or body. ``'Answer this to cross
6060
the bridge'`` is the gist's description. While required by github3.py, it is
6161
allowed to be empty, e.g., ``''`` is accepted by GitHub.

‎docs/source/release-notes/1.0.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ New Features
453453

454454
- Add ``Organization#all_events``.
455455

456-
- Add ``Tag.tagger_as_User`` which attempts to return the tagger as as User.
456+
- Add ``Tag.tagger_as_User`` which attempts to return the tagger as User.
457457

458458
- Add ``Repo.statuses`` and a corresponding ``repo.status.CombinedStatus`` to
459459

@@ -539,7 +539,7 @@ Bugs Fixed
539539
so we accidentally left out our actual hard dependencies.
540540

541541
- The ``context`` parameter to ``Repository#create_status`` now properly
542-
defaults to ``"default"``.
542+
defaults to ``default``.
543543

544544
- Fix AttributeError when ``IssueEvent`` has assignee.
545545

‎docs/source/release-notes/2.1.0.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2.1.0: 2021-09-09
2+
-----------------
3+
4+
Features Added
5+
``````````````
6+
- Add ``maintainer_can_modify`` parameter to ``create_pull`` method of
7+
``Repo`` class.

‎docs/source/release-notes/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ here with the newest releases first.
99
==================
1010

1111
.. toctree::
12+
2.1.0
1213
2.0.0
1314

1415
1.x Release Series

‎src/github3/repos/repo.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,9 @@ def create_project(self, name, body=None):
11511151
return self._instance_or_null(projects.Project, json)
11521152

11531153
@decorators.requires_auth
1154-
def create_pull(self, title, base, head, body=None):
1154+
def create_pull(
1155+
self, title, base, head, body=None, maintainer_can_modify=None
1156+
):
11551157
"""Create a pull request of ``head`` onto ``base`` branch in this repo.
11561158
11571159
:param str title:
@@ -1162,12 +1164,17 @@ def create_pull(self, title, base, head, body=None):
11621164
(required), e.g., 'username:branch'
11631165
:param str body:
11641166
(optional), markdown formatted description
1167+
:param bool maintainer_can_modify:
1168+
(optional), Indicates whether a maintainer is allowed to modify the
1169+
pull request or not.
11651170
:returns:
11661171
the created pull request
11671172
:rtype:
11681173
:class:`~github3.pulls.ShortPullRequest`
11691174
"""
11701175
data = {"title": title, "body": body, "base": base, "head": head}
1176+
if maintainer_can_modify is not None:
1177+
data["maintainer_can_modify"] = maintainer_can_modify
11711178
return self._create_pull(data)
11721179

11731180
@decorators.requires_auth

‎tests/unit/test_github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_create_key(self):
131131
)
132132

133133
def test_create_key_with_readonly(self):
134-
""" Test the request to create a key with read only"""
134+
"""Test the request to create a key with read only"""
135135
self.instance.create_key("key_name", "key text", read_only=True)
136136

137137
self.post_called_with(

‎tests/unit/test_repos_repo.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,19 @@ def test_create_pull(self):
341341
self.instance.create_pull(**data)
342342
pull.assert_called_once_with(data)
343343

344+
def test_create_pull_maintainer_can_modify(self):
345+
"""Verify maintainer_can_modify option for creating a pull request."""
346+
data = {
347+
"title": "foo",
348+
"base": "master",
349+
"head": "feature_branch",
350+
"body": "body",
351+
"maintainer_can_modify": False,
352+
}
353+
with unittest.mock.patch.object(Repository, "_create_pull") as pull:
354+
self.instance.create_pull(**data)
355+
pull.assert_called_once_with(data)
356+
344357
def test_create_pull_from_issue(self):
345358
"""Verify the request for creating a pull request from an issue."""
346359
with unittest.mock.patch.object(Repository, "_create_pull") as pull:

0 commit comments

Comments
 (0)
Please sign in to comment.