/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2008-02-24 16:42:13 UTC
  • mfrom: (3234 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3235.
  • Revision ID: aaron@aaronbentley.com-20080224164213-eza1lzru5bwuwmmj
Merge with bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
# see http://bazaar-vcs.org/Specs/BranchRegistrationTool
23
23
 
 
24
from bzrlib.branch import Branch
24
25
from bzrlib.commands import Command, Option, register_command
 
26
from bzrlib.errors import BzrCommandError, NoPublicBranch, NotBranchError
25
27
from bzrlib.transport import register_lazy_transport
26
28
from bzrlib.help_topics import topic_registry
27
29
 
37
39
    branch belongs, and create an account for yourself on launchpad.net.
38
40
 
39
41
    arguments:
40
 
        branch_url: The publicly visible url for the branch.
41
 
                    This must be an http or https url, not a local file
42
 
                    path.
 
42
        public_url: The publicly visible url for the branch to register.
 
43
                    This must be an http or https url (which Launchpad can read
 
44
                    from to access the branch). Local file urls, SFTP urls, and
 
45
                    bzr+ssh urls will not work.
 
46
                    If no public_url is provided, bzr will use the configured
 
47
                    public_url if there is one for the current branch, and
 
48
                    otherwise error.
43
49
 
44
50
    example:
45
51
        bzr register-branch http://foo.com/bzr/fooproduct.mine \\
46
52
                --product fooproduct
47
53
    """
48
 
    takes_args = ['branch_url']
 
54
    takes_args = ['public_url?']
49
55
    takes_options = [
50
56
         Option('product',
51
57
                'Launchpad product short name to associate with the branch.',
71
77
        ]
72
78
 
73
79
 
74
 
    def run(self, 
75
 
            branch_url, 
 
80
    def run(self,
 
81
            public_url=None,
76
82
            product='',
77
83
            branch_name='',
78
84
            branch_title='',
83
89
        from bzrlib.plugins.launchpad.lp_registration import (
84
90
            LaunchpadService, BranchRegistrationRequest, BranchBugLinkRequest,
85
91
            DryRunLaunchpadService)
86
 
        rego = BranchRegistrationRequest(branch_url=branch_url,
 
92
        if public_url is None:
 
93
            try:
 
94
                b = Branch.open_containing('.')[0]
 
95
            except NotBranchError:
 
96
                raise BzrCommandError('register-branch requires a public '
 
97
                    'branch url - see bzr help register-branch.')
 
98
            public_url = b.get_public_branch()
 
99
            if public_url is None:
 
100
                raise NoPublicBranch(b)
 
101
 
 
102
        rego = BranchRegistrationRequest(branch_url=public_url,
87
103
                                         branch_name=branch_name,
88
104
                                         branch_title=branch_title,
89
105
                                         branch_description=branch_description,
90
106
                                         product_name=product,
91
107
                                         author_email=author,
92
108
                                         )
93
 
        linko = BranchBugLinkRequest(branch_url=branch_url,
 
109
        linko = BranchBugLinkRequest(branch_url=public_url,
94
110
                                     bug_id=link_bug)
95
111
        if not dry_run:
96
112
            service = LaunchpadService()
160
176
    'bzrlib.plugins.launchpad.lp_indirect',
161
177
    'LaunchpadTransport')
162
178
 
163
 
register_lazy_transport(
164
 
    'lp://',
165
 
    'bzrlib.plugins.launchpad.lp_indirect',
166
 
    'LaunchpadTransport')
167
179
 
168
180
def test_suite():
169
181
    """Called by bzrlib to fetch tests for this plugin"""
170
182
    from unittest import TestSuite, TestLoader
171
183
    from bzrlib.plugins.launchpad import (
172
 
        test_register, test_lp_indirect, test_account)
 
184
        test_register, test_lp_indirect, test_lp_registration, test_account)
173
185
 
174
186
    loader = TestLoader()
175
187
    suite = TestSuite()
176
 
    for m in [test_register, test_lp_indirect, test_account]:
 
188
    for m in [
 
189
        test_account,
 
190
        test_register,
 
191
        test_lp_indirect,
 
192
        test_lp_registration,
 
193
        ]:
177
194
        suite.addTests(loader.loadTestsFromModule(m))
178
195
    return suite
179
196