Add repo edit support for delete_branch_on_merge (#1381)

* Add repo edit support for delete_branch_on_merge

* Assert delete_branch_on_merge
This commit is contained in:
Glenn McDonald
2020-02-11 12:24:33 +11:00
committed by GitHub
parent 784deb5f68
commit 9564cd4de7
9 changed files with 45 additions and 9 deletions
+20
View File
@@ -282,6 +282,14 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._default_branch)
return self._default_branch.value
@property
def delete_branch_on_merge(self):
"""
:type: bool
"""
self._completeIfNotSet(self._delete_branch_on_merge)
return self._delete_branch_on_merge.value
@property
def description(self):
"""
@@ -1399,6 +1407,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
allow_squash_merge=github.GithubObject.NotSet,
allow_merge_commit=github.GithubObject.NotSet,
allow_rebase_merge=github.GithubObject.NotSet,
delete_branch_on_merge=github.GithubObject.NotSet,
archived=github.GithubObject.NotSet,
):
"""
@@ -1415,6 +1424,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
:param allow_squash_merge: bool
:param allow_merge_commit: bool
:param allow_rebase_merge: bool
:param delete_branch_on_merge: bool
:param archived: bool. Unarchiving repositories is currently not supported through API (https://developer.github.com/v3/repos/#edit)
:rtype: None
"""
@@ -1454,6 +1464,9 @@ class Repository(github.GithubObject.CompletableGithubObject):
assert allow_rebase_merge is github.GithubObject.NotSet or isinstance(
allow_rebase_merge, bool
), allow_rebase_merge
assert delete_branch_on_merge is github.GithubObject.NotSet or isinstance(
delete_branch_on_merge, bool
), delete_branch_on_merge
assert archived is github.GithubObject.NotSet or (
isinstance(archived, bool) and archived is True
), archived
@@ -1482,6 +1495,8 @@ class Repository(github.GithubObject.CompletableGithubObject):
post_parameters["allow_merge_commit"] = allow_merge_commit
if allow_rebase_merge is not github.GithubObject.NotSet:
post_parameters["allow_rebase_merge"] = allow_rebase_merge
if delete_branch_on_merge is not github.GithubObject.NotSet:
post_parameters["delete_branch_on_merge"] = delete_branch_on_merge
if archived is not github.GithubObject.NotSet:
post_parameters["archived"] = archived
headers, data = self._requester.requestJsonAndCheck(
@@ -3121,6 +3136,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._contributors_url = github.GithubObject.NotSet
self._created_at = github.GithubObject.NotSet
self._default_branch = github.GithubObject.NotSet
self._delete_branch_on_merge = github.GithubObject.NotSet
self._description = github.GithubObject.NotSet
self._downloads_url = github.GithubObject.NotSet
self._events_url = github.GithubObject.NotSet
@@ -3230,6 +3246,10 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._default_branch = self._makeStringAttribute(
attributes["default_branch"]
)
if "delete_branch_on_merge" in attributes: # pragma no branch
self._delete_branch_on_merge = self._makeBoolAttribute(
attributes["delete_branch_on_merge"]
)
if "description" in attributes: # pragma no branch
self._description = self._makeStringAttribute(attributes["description"])
if "downloads_url" in attributes: # pragma no branch