/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: Robert Collins
  • Date: 2008-02-06 04:06:42 UTC
  • mfrom: (3216 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3217.
  • Revision ID: robertc@robertcollins.net-20080206040642-2efx3l4iv5f95lxp
Merge up 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
 
182
199
Launchpad.net provides free Bazaar branch hosting with integrated bug and
183
200
specification tracking.
184
201
 
185
 
The bzr client (through the plugin called 'launchpad') has two special
 
202
The bzr client (through the plugin called 'launchpad') has special
186
203
features to communicate with Launchpad:
187
204
 
188
 
    * The register-branch command tells launchpad about the url of a 
 
205
    * The launchpad-login command tells Bazaar your Launchpad user name. This
 
206
      is then used by the 'lp:' transport to download your branches using
 
207
      bzr+ssh://.
 
208
 
 
209
    * The register-branch command tells Launchpad about the url of a
189
210
      public branch.  Launchpad will then mirror the branch, display
190
 
      its contents and allow it to be attached to bugs and other 
 
211
      its contents and allow it to be attached to bugs and other
191
212
      objects.
192
213
 
193
 
    * The 'lp:' transport uses Launchpad as a directory service: 
194
 
      for example 'lp:bzr' and 'lp:python' refer to the main branches of the
195
 
      relevant projects and may be branched, logged, etc.  (Only read access
196
 
      is supported at present.)
 
214
    * The 'lp:' transport uses Launchpad as a directory service: for example
 
215
      'lp:bzr' and 'lp:python' refer to the main branches of the relevant
 
216
      projects and may be branched, logged, etc. You can also use the 'lp:'
 
217
      transport to refer to specific branches, e.g. lp:///~bzr/bzr/trunk.
197
218
 
198
219
For more information see http://help.launchpad.net/
199
220
"""