Skip to content

Commit

Permalink
Adding archival support for Repository.edit (#843)
Browse files Browse the repository at this point in the history
Fixes ##840 

Adding archival support to Repository.edit

No unit tests are included for this change because while you can archive a repository via the edit API, there is no way to un-archive a repository via the edit API.  (See: https://developer.github.com/v3/repos/#edit )
  • Loading branch information
sechastain authored and sfdye committed Jul 12, 2018
1 parent 9d9ce34 commit 1a90f5d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion github/Repository.py
Expand Up @@ -1161,7 +1161,7 @@ def delete(self):
self.url
)

def edit(self, name=None, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, default_branch=github.GithubObject.NotSet):
def edit(self, name=None, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, default_branch=github.GithubObject.NotSet, archived=github.GithubObject.NotSet):
"""
:calls: `PATCH /repos/:owner/:repo <http://developer.github.com/v3/repos>`_
:param name: string
Expand All @@ -1172,6 +1172,7 @@ def edit(self, name=None, description=github.GithubObject.NotSet, homepage=githu
:param has_wiki: bool
:param has_downloads: bool
:param default_branch: string
:param archived: bool. Unarchiving repositories is currently not supported through API (https://developer.github.com/v3/repos/#edit)
:rtype: None
"""
if name is None:
Expand All @@ -1184,6 +1185,7 @@ def edit(self, name=None, description=github.GithubObject.NotSet, homepage=githu
assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
assert default_branch is github.GithubObject.NotSet or isinstance(default_branch, (str, unicode)), default_branch
assert archived is github.GithubObject.NotSet or (isinstance(archived, bool) and archived is True), archived
post_parameters = {
"name": name,
}
Expand All @@ -1201,6 +1203,8 @@ def edit(self, name=None, description=github.GithubObject.NotSet, homepage=githu
post_parameters["has_downloads"] = has_downloads
if default_branch is not github.GithubObject.NotSet:
post_parameters["default_branch"] = default_branch
if archived is not github.GithubObject.NotSet:
post_parameters["archived"] = archived
headers, data = self._requester.requestJsonAndCheck(
"PATCH",
self.url,
Expand Down

0 comments on commit 1a90f5d

Please sign in to comment.