~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Martin Pool
  • Date: 2006-03-22 20:00:48 UTC
  • mto: (1668.1.8 bzr-0.8.mbp)
  • mto: This revision was merged to the branch mainline in revision 1710.
  • Revision ID: mbp@sourcefrog.net-20060322200048-4a2718c8e8770351
(register-branch) Add command-line options
Refactor the way the BranchRegistrationRequest is constructed

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    launchpad.net.  Registration allows the bug to be associated with
36
36
    bugs or specifications.
37
37
    
38
 
    Before using this command you must register the project to which the
 
38
    Before using this command you must register the product to which the
39
39
    branch belongs, and create an account for yourself on launchpad.net.
40
40
 
41
41
    arguments:
44
44
                    path.
45
45
 
46
46
    example:
47
 
        bzr register-branch http://foo.com/bzr/fooproject.mine \
48
 
                --project fooproject
 
47
        bzr register-branch http://foo.com/bzr/fooproduct.mine \\
 
48
                --product fooproduct
49
49
    """
50
50
    takes_args = ['branch_url']
51
 
 
52
 
    def run(self, branch_url):
53
 
        from lp_registration import register_interactive
54
 
        register_interactive(branch_url)
 
51
    takes_options = \
 
52
        [Option('product', 
 
53
                'launchpad product short name to associate with the branch',
 
54
                unicode),
 
55
         Option('branch-name',
 
56
                'short name for the branch; '
 
57
                'by default taken from the last component of the url',
 
58
                unicode),
 
59
         Option('branch-title',
 
60
                'one-sentence description of the branch',
 
61
                unicode),
 
62
         Option('branch-description',
 
63
                'longer description of the purpose or contents of the branch',
 
64
                unicode),
 
65
         Option('dry-run',
 
66
                'prepare the request but don\'t actually send it')
 
67
        ]
 
68
 
 
69
 
 
70
    def run(self, 
 
71
            branch_url, 
 
72
            product='', 
 
73
            branch_name='',
 
74
            branch_title='',
 
75
            branch_description='',
 
76
            dry_run=False):
 
77
        from lp_registration import BranchRegistrationRequest
 
78
        if dry_run:
 
79
            raise NotImplementedError('--dry-run for register-branch')
 
80
        rego = BranchRegistrationRequest(branch_url=branch_url, 
 
81
                                         branch_name=branch_name,
 
82
                                         branch_title=branch_title,
 
83
                                         branch_description=branch_description,
 
84
                                         product_name=product,
 
85
                                         )
 
86
        rego.register_interactive()
55
87
 
56
88
register_command(cmd_register_branch)
57
89