~ubuntu-branches/ubuntu/natty/bzr/natty-proposed

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-08-07 00:54:52 UTC
  • mfrom: (1.4.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100807005452-g4zb99ezl3xn44r4
Tags: 2.2.0-1
* New upstream release.
 + Adds support for setting timestamps to originating revisions.
   Closes: #473450
 + Removes remaining string exception. Closes: #585193, LP: #586926
 + Add C extension to work around Python issue 1628205. LP: #583941,
   Closes: #577110
 + Avoids showing progress bars when --quiet is used. Closes: #542105,
   LP: #320035
 + No longer creates ~/.bazaar as root when run under sudo. LP: #376388
 + 'bzr commit' now supports -p as alternative for --show-diff. LP: #571467
 + 'bzr add' no longer adds .THIS/.BASE/.THEIRS files unless
   explicitly requested. LP: #322767
 + When parsing patch files, Bazaar now supports diff lines before each
   patch. LP: #502076
 + WorkingTrees now no longer requires using signal.signal, so can
   be used in a threaded environment. LP: #521989
 + An assertion error is no longer triggered when pushing to a pre-1.6
   Bazaar server. LP: #528041
* Bump standards version to 3.9.1.

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):
48
 
    """Register a branch with launchpad.net.
 
56
    __doc__ = """Register a branch with launchpad.net.
49
57
 
50
58
    This command lists a bzr branch in the directory of branches on
51
59
    launchpad.net.  Registration allows the branch to be associated with
153
161
 
154
162
 
155
163
class cmd_launchpad_open(Command):
156
 
    """Open a Launchpad branch page in your web browser."""
 
164
    __doc__ = """Open a Launchpad branch page in your web browser."""
157
165
 
158
166
    aliases = ['lp-open']
159
167
    takes_options = [
203
211
 
204
212
 
205
213
class cmd_launchpad_login(Command):
206
 
    """Show or set the Launchpad user ID.
 
214
    __doc__ = """Show or set the Launchpad user ID.
207
215
 
208
216
    When communicating with Launchpad, some commands need to know your
209
217
    Launchpad user ID.  This command can be used to set or show the
259
267
 
260
268
# XXX: cmd_launchpad_mirror is untested
261
269
class cmd_launchpad_mirror(Command):
262
 
    """Ask Launchpad to mirror a branch now."""
 
270
    __doc__ = """Ask Launchpad to mirror a branch now."""
263
271
 
264
272
    aliases = ['lp-mirror']
265
273
    takes_args = ['location?']
277
285
register_command(cmd_launchpad_mirror)
278
286
 
279
287
 
 
288
class cmd_lp_propose_merge(Command):
 
289
    __doc__ = """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
                     Option('approve',
 
314
                            help='Mark the proposal as approved immediately.'),
 
315
                     ListOption('review', short_name='R', type=unicode,
 
316
                            help='Requested reviewer and optional type.')]
 
317
 
 
318
    takes_args = ['submit_branch?']
 
319
 
 
320
    aliases = ['lp-submit', 'lp-propose']
 
321
 
 
322
    def run(self, submit_branch=None, review=None, staging=False,
 
323
            message=None, approve=False):
 
324
        from bzrlib.plugins.launchpad import lp_propose
 
325
        tree, branch, relpath = bzrdir.BzrDir.open_containing_tree_or_branch(
 
326
            '.')
 
327
        if review is None:
 
328
            reviews = None
 
329
        else:
 
330
            reviews = []
 
331
            for review in review:
 
332
                if '=' in review:
 
333
                    reviews.append(review.split('=', 2))
 
334
                else:
 
335
                    reviews.append((review, ''))
 
336
            if submit_branch is None:
 
337
                submit_branch = branch.get_submit_branch()
 
338
        if submit_branch is None:
 
339
            target = None
 
340
        else:
 
341
            target = _mod_branch.Branch.open(submit_branch)
 
342
        proposer = lp_propose.Proposer(tree, branch, target, message,
 
343
                                       reviews, staging, approve=approve)
 
344
        proposer.check_proposal()
 
345
        proposer.create_proposal()
 
346
 
 
347
 
 
348
register_command(cmd_lp_propose_merge)
 
349
 
 
350
 
280
351
def _register_directory():
281
352
    directories.register_lazy('lp:', 'bzrlib.plugins.launchpad.lp_directory',
282
353
                              'LaunchpadDirectory',