Skip to content

Commit ea95f83

Browse files
authored
Merge pull request sigmavirus24#630 from AndyMan1/364-backport
Copy pull request sigmavirus24#364 into stable/0.9
2 parents 563d542 + 06f4a6a commit ea95f83

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,4 @@ Contributors
8383

8484
- Lars Holm Nielsen (@larshankat)
8585

86+
- Ryan Pitts (@ryanpitts)

github3/repos/contents.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ def __ne__(self, other):
9494
return self.sha != other
9595

9696
@requires_auth
97-
def delete(self, message, committer=None, author=None):
97+
def delete(self, message, branch=None, committer=None, author=None):
9898
"""Delete this file.
9999
100100
:param str message: (required), commit message to describe the removal
101+
:param str branch: (optional), branch where the file exists.
102+
Defaults to the default branch of the repository.
101103
:param dict committer: (optional), if no information is given the
102104
authenticated user's information will be used. You must specify
103105
both a name and email.
@@ -109,7 +111,7 @@ def delete(self, message, committer=None, author=None):
109111
"""
110112
json = None
111113
if message:
112-
data = {'message': message, 'sha': self.sha,
114+
data = {'message': message, 'sha': self.sha, 'branch': branch,
113115
'committer': validate_commmitter(committer),
114116
'author': validate_commmitter(author)}
115117
self._remove_none(data)
@@ -119,11 +121,14 @@ def delete(self, message, committer=None, author=None):
119121
return json
120122

121123
@requires_auth
122-
def update(self, message, content, committer=None, author=None):
124+
def update(self, message, content, branch=None, committer=None,
125+
author=None):
123126
"""Update this file.
124127
125128
:param str message: (required), commit message to describe the update
126129
:param str content: (required), content to update the file with
130+
:param str branch: (optional), branch where the file exists.
131+
Defaults to the default branch of the repository.
127132
:param dict committer: (optional), if no information is given the
128133
authenticated user's information will be used. You must specify
129134
both a name and email.
@@ -140,7 +145,8 @@ def update(self, message, content, committer=None, author=None):
140145
json = None
141146
if message and content:
142147
content = b64encode(content).decode('utf-8')
143-
data = {'message': message, 'content': content, 'sha': self.sha,
148+
data = {'message': message, 'content': content, 'branch': branch,
149+
'sha': self.sha,
144150
'committer': validate_commmitter(committer),
145151
'author': validate_commmitter(author)}
146152
self._remove_none(data)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy