/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/launchpad.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-01-24 01:26:24 UTC
  • mfrom: (7240.4.1 propose-launchpad-git)
  • Revision ID: breezy.the.bot@gmail.com-20190124012624-zo0fseou6kr7b8d3
propose: Some fixes for handling of Git repositories on Launchpad.

Merged from https://code.launchpad.net/~jelmer/brz/propose-launchpad-git/+merge/361995

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
    def is_merged(self):
135
135
        return (self._mp.queue_status == 'Merged')
136
136
 
 
137
    def get_description(self):
 
138
        return self._mp.description
 
139
 
 
140
    def set_description(self, description):
 
141
        self._mp.description = description
 
142
 
137
143
 
138
144
class Launchpad(Hoster):
139
145
    """The Launchpad hosting service."""
188
194
    def _get_derived_git_path(self, base_path, owner, project):
189
195
        base_repo = self.launchpad.git_repositories.getByPath(path=base_path)
190
196
        if project is None:
191
 
            project = '/'.join(base_repo.unique_name.split('/')[1:])
 
197
            project = urlutils.parse_url(base_repo.git_ssh_url)[-1].strip('/')
 
198
        if project.startswith('~'):
 
199
            project = '/'.join(base_path.split('/')[1:])
192
200
        # TODO(jelmer): Surely there is a better way of creating one of these
193
201
        # URLs?
194
202
        return "~%s/%s" % (owner, project)
317
325
        elif base_vcs == 'git':
318
326
            to_path = self._get_derived_git_path(
319
327
                base_path.strip('/'), owner, project)
320
 
            return _mod_branch.Branch.open(
321
 
                "git+ssh://git.launchpad.net/" + to_path, name)
 
328
            to_url = urlutils.join_segment_parameters(
 
329
                "git+ssh://git.launchpad.net/" + to_path,
 
330
                {'branch': name})
 
331
            return _mod_branch.Branch.open(to_url)
322
332
        else:
323
333
            raise AssertionError('not a valid Launchpad URL')
324
334
 
337
347
                yield LaunchpadMergeProposal(mp)
338
348
        elif base_vcs == 'git':
339
349
            (source_repo_lp, source_branch_lp) = (
340
 
                self.lp_host._get_lp_git_ref_from_branch(source_branch))
 
350
                self._get_lp_git_ref_from_branch(source_branch))
341
351
            (target_repo_lp, target_branch_lp) = (
342
 
                self.lp_host._get_lp_git_ref_from_branch(target_branch))
 
352
                self._get_lp_git_ref_from_branch(target_branch))
343
353
            for mp in target_branch_lp.getMergeProposals(status=statuses):
344
354
                if (target_branch_lp.path != mp.target_git_path or
345
355
                        target_repo_lp != mp.target_git_repository or
610
620
                self.source_branch_lp.createMergeProposal,
611
621
                merge_target=self.target_branch_lp,
612
622
                merge_prerequisite=prereq_branch_lp,
613
 
                initial_comment=description.strip().encode('utf-8'),
 
623
                initial_comment=description.strip(),
614
624
                commit_message=self.commit_message,
615
625
                needs_review=True,
616
626
                reviewers=[self.launchpad.people[reviewer].self_link