mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Support for create_fork (#1306)
* Support for create_fork http://developer.github.com/v3/repos/forks * Add test case for create_fork * Add param doc and fix extra line * Specify the organization to increase line coverage * Update test data * Add type assert for organization param
This commit is contained in:
@@ -1867,6 +1867,23 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def create_fork(self, organization=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `POST /repos/:owner/:repo/forks <http://developer.github.com/v3/repos/forks>`_
|
||||
:param organization: string or "none" or "*"
|
||||
:rtype: :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert organization is github.GithubObject.NotSet or isinstance(organization, (str, six.text_type)), organization
|
||||
post_parameters = {}
|
||||
if organization is not None:
|
||||
post_parameters["organization"] = organization
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self.url + "/forks",
|
||||
input=post_parameters,
|
||||
)
|
||||
return Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_git_blob(self, sha):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/git/blobs/:sha <http://developer.github.com/v3/git/blobs>`_
|
||||
|
||||
Reference in New Issue
Block a user