22
22
in your ~/.bazaar/plugins/ directory.
25
# The XMLRPC server address can be overridden by setting the environment
26
# variable $BZR_LP_XMLRPL_URL
28
25
# see http://bazaar-vcs.org/Specs/BranchRegistrationTool
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.
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.
50
bzr register-branch http://foo.com/bzr/fooproduct.mine \\
47
bzr register-branch http://foo.com/bzr/fooproject.mine \
53
50
takes_args = ['branch_url']
56
'launchpad product short name to associate with the branch',
59
'short name for the branch; '
60
'by default taken from the last component of the url',
62
Option('branch-title',
63
'one-sentence description of the branch',
65
Option('branch-description',
66
'longer description of the purpose or contents of the branch',
69
'email of the branch\'s author, if not yourself',
72
'the bug this branch fixes',
75
'prepare the request but don\'t actually send it')
84
branch_description='',
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,
97
linko = BranchBugLinkRequest(branch_url=branch_url,
99
service = LaunchpadService()
100
service.gather_user_credentials()
102
print rego.submit(service)
104
print linko.submit(service)
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)
106
61
register_command(cmd_register_branch)