~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Martin Pool
  • Date: 2006-03-16 17:41:43 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-20060316174143-bfe06d83cd3d3942
Check the correct params are seen by the server

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
in your ~/.bazaar/plugins/ directory.
23
23
"""
24
24
 
25
 
# The XMLRPC server address can be overridden by setting the environment
26
 
# variable $BZR_LP_XMLRPL_URL
27
 
 
28
25
# see http://bazaar-vcs.org/Specs/BranchRegistrationTool
29
26
 
30
27
from bzrlib.commands import Command, Option, register_command
38
35
    launchpad.net.  Registration allows the bug to be associated with
39
36
    bugs or specifications.
40
37
    
41
 
    Before using this command you must register the product to which the
 
38
    Before using this command you must register the project to which the
42
39
    branch belongs, and create an account for yourself on launchpad.net.
43
40
 
44
41
    arguments:
47
44
                    path.
48
45
 
49
46
    example:
50
 
        bzr register-branch http://foo.com/bzr/fooproduct.mine \\
51
 
                --product fooproduct
 
47
        bzr register-branch http://foo.com/bzr/fooproject.mine \
 
48
                --project fooproject
52
49
    """
53
50
    takes_args = ['branch_url']
54
 
    takes_options = \
55
 
        [Option('product', 
56
 
                'launchpad product short name to associate with the branch',
57
 
                unicode),
58
 
         Option('branch-name',
59
 
                'short name for the branch; '
60
 
                'by default taken from the last component of the url',
61
 
                unicode),
62
 
         Option('branch-title',
63
 
                'one-sentence description of the branch',
64
 
                unicode),
65
 
         Option('branch-description',
66
 
                'longer description of the purpose or contents of the branch',
67
 
                unicode),
68
 
         Option('author', 
69
 
                'email of the branch\'s author, if not yourself',
70
 
                unicode),
71
 
         Option('link-bug',
72
 
                'the bug this branch fixes',
73
 
                int),
74
 
         Option('dry-run',
75
 
                'prepare the request but don\'t actually send it')
76
 
        ]
77
 
 
78
 
 
79
 
    def run(self, 
80
 
            branch_url, 
81
 
            product='', 
82
 
            branch_name='',
83
 
            branch_title='',
84
 
            branch_description='',
85
 
            author='',
86
 
            link_bug=None,
87
 
            dry_run=False):
88
 
        from lp_registration import (
89
 
            LaunchpadService, BranchRegistrationRequest, BranchBugLinkRequest)
90
 
        rego = BranchRegistrationRequest(branch_url=branch_url, 
91
 
                                         branch_name=branch_name,
92
 
                                         branch_title=branch_title,
93
 
                                         branch_description=branch_description,
94
 
                                         product_name=product,
95
 
                                         author_email=author,
96
 
                                         )
97
 
        linko = BranchBugLinkRequest(branch_url=branch_url,
98
 
                                     bug_id=link_bug)
99
 
        service = LaunchpadService()
100
 
        service.gather_user_credentials()
101
 
        if not dry_run:
102
 
            print rego.submit(service)
103
 
            if link_bug:
104
 
                print linko.submit(service)
 
51
 
 
52
    def run(self, branch_url):
 
53
        from lp_registration import BranchRegistrationRequest
 
54
        def _find_default_branch_id(branch_url):
 
55
            i = branch_url.rfind('/')
 
56
            return branch_url[i+1:]
 
57
        branch_id = _find_default_branch_id(branch_url)
 
58
        rego = BranchRegistrationRequest(branch_url, branch_id)
 
59
        rego.submit()
105
60
 
106
61
register_command(cmd_register_branch)
107
62