~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/launchpad/__init__.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Launchpad.net integration plugin for Bazaar."""
18
18
 
19
19
# The XMLRPC server address can be overridden by setting the environment
20
 
# variable $BZR_LP_XMLRPL_URL
 
20
# variable $BZR_LP_XMLRPC_URL
21
21
 
22
22
# see http://bazaar-vcs.org/Specs/BranchRegistrationTool
23
23
 
32
32
    )
33
33
""")
34
34
 
35
 
from bzrlib.commands import Command, Option, register_command
 
35
from bzrlib import bzrdir
 
36
from bzrlib.commands import (
 
37
        Command,
 
38
        register_command,
 
39
)
36
40
from bzrlib.directory_service import directories
37
41
from bzrlib.errors import (
38
42
    BzrCommandError,
42
46
    NotBranchError,
43
47
    )
44
48
from bzrlib.help_topics import topic_registry
 
49
from bzrlib.option import (
 
50
        Option,
 
51
        ListOption,
 
52
)
45
53
 
46
54
 
47
55
class cmd_register_branch(Command):
277
285
register_command(cmd_launchpad_mirror)
278
286
 
279
287
 
 
288
class cmd_lp_propose_merge(Command):
 
289
    """Propose merging a branch on Launchpad.
 
290
 
 
291
    This will open your usual editor to provide the initial comment.  When it
 
292
    has created the proposal, it will open it in your default web browser.
 
293
 
 
294
    The branch will be proposed to merge into SUBMIT_BRANCH.  If SUBMIT_BRANCH
 
295
    is not supplied, the remembered submit branch will be used.  If no submit
 
296
    branch is remembered, the development focus will be used.
 
297
 
 
298
    By default, the SUBMIT_BRANCH's review team will be requested to review
 
299
    the merge proposal.  This can be overriden by specifying --review (-R).
 
300
    The parameter the launchpad account name of the desired reviewer.  This
 
301
    may optionally be followed by '=' and the review type.  For example:
 
302
 
 
303
      bzr lp-propose-merge --review jrandom --review review-team=qa
 
304
 
 
305
    This will propose a merge,  request "jrandom" to perform a review of
 
306
    unspecified type, and request "review-team" to perform a "qa" review.
 
307
    """
 
308
 
 
309
    takes_options = [Option('staging',
 
310
                            help='Propose the merge on staging.'),
 
311
                     Option('message', short_name='m', type=unicode,
 
312
                            help='Commit message.'),
 
313
                     ListOption('review', short_name='R', type=unicode,
 
314
                            help='Requested reviewer and optional type.')]
 
315
 
 
316
    takes_args = ['submit_branch?']
 
317
 
 
318
    aliases = ['lp-submit', 'lp-propose']
 
319
 
 
320
    def run(self, submit_branch=None, review=None, staging=False,
 
321
            message=None):
 
322
        from bzrlib.plugins.launchpad import lp_propose
 
323
        tree, branch, relpath = bzrdir.BzrDir.open_containing_tree_or_branch(
 
324
            '.')
 
325
        if review is None:
 
326
            reviews = None
 
327
        else:
 
328
            reviews = []
 
329
            for review in review:
 
330
                if '=' in review:
 
331
                    reviews.append(review.split('=', 2))
 
332
                else:
 
333
                    reviews.append((review, ''))
 
334
            if submit_branch is None:
 
335
                submit_branch = branch.get_submit_branch()
 
336
        if submit_branch is None:
 
337
            target = None
 
338
        else:
 
339
            target = _mod_branch.Branch.open(submit_branch)
 
340
        proposer = lp_propose.Proposer(tree, branch, target, message,
 
341
                                       reviews, staging)
 
342
        proposer.check_proposal()
 
343
        proposer.create_proposal()
 
344
 
 
345
 
 
346
register_command(cmd_lp_propose_merge)
 
347
 
 
348
 
280
349
def _register_directory():
281
350
    directories.register_lazy('lp:', 'bzrlib.plugins.launchpad.lp_directory',
282
351
                              'LaunchpadDirectory',