/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: John Arbash Meinel
  • Date: 2009-07-08 14:37:25 UTC
  • mfrom: (4516 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4517.
  • Revision ID: john@arbash-meinel.com-20090708143725-sc9sjy3mz4cxwxzz
Merge bzr.dev 4516

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
from bzrlib.lazy_import import lazy_import
28
28
lazy_import(globals(), """
29
 
import webbrowser
30
 
 
31
29
from bzrlib import (
32
30
    branch as _mod_branch,
33
31
    trace,
56
54
    launchpad.net.  Registration allows the branch to be associated with
57
55
    bugs or specifications.
58
56
 
59
 
    Before using this command you must register the product to which the
 
57
    Before using this command you must register the project to which the
60
58
    branch belongs, and create an account for yourself on launchpad.net.
61
59
 
62
60
    arguments:
69
67
                    otherwise error.
70
68
 
71
69
    example:
72
 
        bzr register-branch http://foo.com/bzr/fooproduct.mine \\
73
 
                --product fooproduct
 
70
        bzr register-branch http://foo.com/bzr/fooproject.mine \\
 
71
                --project fooproject
74
72
    """
75
73
    takes_args = ['public_url?']
76
74
    takes_options = [
 
75
         Option('project',
 
76
                'Launchpad project short name to associate with the branch.',
 
77
                unicode),
77
78
         Option('product',
78
 
                'Launchpad product short name to associate with the branch.',
79
 
                unicode),
 
79
                'Launchpad product short name to associate with the branch.', 
 
80
                unicode,
 
81
                hidden=True),
80
82
         Option('branch-name',
81
83
                'Short name for the branch; '
82
84
                'by default taken from the last component of the url.',
100
102
 
101
103
    def run(self,
102
104
            public_url=None,
103
 
            product='',
 
105
            project='',
 
106
            product=None,
104
107
            branch_name='',
105
108
            branch_title='',
106
109
            branch_description='',
119
122
            public_url = b.get_public_branch()
120
123
            if public_url is None:
121
124
                raise NoPublicBranch(b)
 
125
        if product is not None:
 
126
            project = product
 
127
            trace.note('--product is deprecated; please use --project.')
 
128
 
122
129
 
123
130
        rego = BranchRegistrationRequest(branch_url=public_url,
124
131
                                         branch_name=branch_name,
125
132
                                         branch_title=branch_title,
126
133
                                         branch_description=branch_description,
127
 
                                         product_name=product,
 
134
                                         product_name=project,
128
135
                                         author_email=author,
129
136
                                         )
130
137
        linko = BranchBugLinkRequest(branch_url=public_url,
187
194
        web_url = self._get_web_url(LaunchpadService(), location)
188
195
        trace.note('Opening %s in web browser' % web_url)
189
196
        if not dry_run:
 
197
            import webbrowser   # this import should not be lazy
 
198
                                # otherwise bzr.exe lacks this module
190
199
            webbrowser.open(web_url)
191
200
 
192
201
register_command(cmd_launchpad_open)
211
220
    aliases = ['lp-login']
212
221
    takes_args = ['name?']
213
222
    takes_options = [
 
223
        'verbose',
214
224
        Option('no-check',
215
225
               "Don't check that the user name is valid."),
216
226
        ]
217
227
 
218
 
    def run(self, name=None, no_check=False):
 
228
    def run(self, name=None, no_check=False, verbose=False):
219
229
        from bzrlib.plugins.launchpad import account
220
230
        check_account = not no_check
221
231
 
224
234
            if username:
225
235
                if check_account:
226
236
                    account.check_lp_login(username)
 
237
                    if verbose:
 
238
                        self.outf.write(
 
239
                            "Launchpad user ID exists and has SSH keys.\n")
227
240
                self.outf.write(username + '\n')
228
241
            else:
229
242
                self.outf.write('No Launchpad user ID configured.\n')
232
245
            name = name.lower()
233
246
            if check_account:
234
247
                account.check_lp_login(name)
 
248
                if verbose:
 
249
                    self.outf.write(
 
250
                        "Launchpad user ID exists and has SSH keys.\n")
235
251
            account.set_lp_login(name)
 
252
            if verbose:
 
253
                self.outf.write("Launchpad user ID set to '%s'.\n" % (name,))
236
254
 
237
255
register_command(cmd_launchpad_login)
238
256
 
250
268
    from bzrlib.plugins.launchpad import (
251
269
        test_account,
252
270
        test_lp_directory,
 
271
        test_lp_login,
253
272
        test_lp_open,
254
273
        test_lp_service,
255
274
        test_register,
261
280
        test_account,
262
281
        test_register,
263
282
        test_lp_directory,
 
283
        test_lp_login,
264
284
        test_lp_open,
265
285
        test_lp_service,
266
286
        ]: