/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/propose/github.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-01-10 02:20:50 UTC
  • mfrom: (7414.5.2 project-management)
  • Revision ID: breezy.the.bot@gmail.com-20200110022050-de0fq4l1fsgvawfv
Add functions for managing projects.

Merged from https://code.launchpad.net/~jelmer/brz/project-management/+merge/376820

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
    def get_target_branch_url(self):
142
142
        return self._branch_from_part(self._pr['base'])
143
143
 
 
144
    def get_source_project(self):
 
145
        return self._pr['head']['repo']['full_name']
 
146
 
 
147
    def get_target_project(self):
 
148
        return self._pr['base']['repo']['full_name']
 
149
 
144
150
    def get_description(self):
145
151
        return self._pr['body']
146
152
 
499
505
    def get_proposal_by_url(self, url):
500
506
        raise UnsupportedHoster(url)
501
507
 
 
508
    def iter_my_forks(self):
 
509
        response = self._api_request('GET', '/user/repos')
 
510
        if response.status != 200:
 
511
            raise InvalidHttpResponse(url, response.text)
 
512
        for project in json.loads(response.text):
 
513
            if not project['fork']:
 
514
                continue
 
515
            yield project['full_name']
 
516
 
 
517
    def delete_project(self, path):
 
518
        path = 'repos/' + path
 
519
        response = self._api_request('DELETE', path)
 
520
        if response.status == 404:
 
521
            raise NoSuchProject(path)
 
522
        if response.status == 204:
 
523
            return
 
524
        if response.status == 200:
 
525
            return json.loads(response.text)
 
526
        raise InvalidHttpResponse(path, response.text)
 
527
 
502
528
 
503
529
class GitHubMergeProposalBuilder(MergeProposalBuilder):
504
530