/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/github/hoster.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-19 22:18:01 UTC
  • mfrom: (7515.1.1 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20200619221801-6chb6w22ctckkajl
Merge lp:brz/3.1.

Merged from https://code.launchpad.net/~jelmer/brz/merge-3.1/+merge/386125

Show diffs side-by-side

added added

removed removed

Lines of Context:
185
185
 
186
186
    def merge(self, commit_message=None):
187
187
        # https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button
188
 
        self._pr.merge(commit_message=commit_message)
 
188
        data = {}
 
189
        if commit_message:
 
190
            data['commit_message'] = commit_messae
 
191
        response = self._gh._api_request(
 
192
            'PUT', self._pr['url'] + "/merge", body=json.dumps(data).encode('utf-8'))
 
193
        if response.status == 422:
 
194
            raise ValidationFailed(json.loads(response.text))
 
195
        if response.status != 200:
 
196
            raise InvalidHttpResponse(self._pr['url'], response.text)
189
197
 
190
198
    def get_merged_by(self):
191
199
        merged_by = self._pr.get('merged_by')
200
208
        import iso8601
201
209
        return iso8601.parse_date(merged_at)
202
210
 
 
211
    def post_comment(self, body):
 
212
        data = {'body': body}
 
213
        response = self._gh._api_request(
 
214
            'POST', self._pr['comments_url'], body=json.dumps(data).encode('utf-8'))
 
215
        if response.status == 422:
 
216
            raise ValidationFailed(json.loads(response.text))
 
217
        if response.status != 201:
 
218
            raise InvalidHttpResponse(self._pr['comments_url'], response.text)
 
219
        json.loads(response.text)
 
220
 
203
221
 
204
222
def parse_github_url(url):
205
223
    (scheme, user, password, host, port, path) = urlutils.parse_url(