1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# Copyright (C) 2006 by Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Launchpad.net branch registration plugin for bzr
This adds commands that tell launchpad about newly-created branches, etc.
To install this file, put the 'bzr_lp' directory, or a symlink to it,
in your ~/.bazaar/plugins/ directory.
"""
# see http://bazaar-vcs.org/Specs/BranchRegistrationTool
from bzrlib.commands import Command, Option, register_command
class cmd_register_branch(Command):
"""Register a branch with launchpad.net.
This command lists a bzr branch in the directory of branches on
launchpad.net. Registration allows the bug to be associated with
bugs or specifications.
Before using this command you must register the project to which the
branch belongs, and create an account for yourself on launchpad.net.
arguments:
branch_url: The publicly visible url for the branch.
This must be an http or https url, not a local file
path.
example:
bzr register-branch http://foo.com/bzr/fooproject.mine \
--project fooproject
"""
takes_args = ['branch_url']
def run(self, branch_url):
from lp_registration import BranchRegistrationRequest
def _find_default_branch_id(branch_url):
i = branch_url.rfind('/')
return branch_url[i+1:]
branch_id = _find_default_branch_id(branch_url)
rego = BranchRegistrationRequest(branch_url, branch_id)
rego.submit()
register_command(cmd_register_branch)
def test_suite():
"""Called by bzrlib to fetch tests for this plugin"""
from unittest import TestSuite, TestLoader
import test_register
return TestLoader().loadTestsFromModule(test_register)
|