13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
"""Launchpad.net integration plugin for Bazaar."""
22
22
# see http://bazaar-vcs.org/Specs/BranchRegistrationTool
24
# Since we are a built-in plugin we share the bzrlib version
25
from bzrlib import version_info
24
27
from bzrlib.lazy_import import lazy_import
25
28
lazy_import(globals(), """
28
29
from bzrlib import (
29
30
branch as _mod_branch,
53
54
launchpad.net. Registration allows the branch to be associated with
54
55
bugs or specifications.
56
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
57
58
branch belongs, and create an account for yourself on launchpad.net.
69
bzr register-branch http://foo.com/bzr/fooproduct.mine \\
70
bzr register-branch http://foo.com/bzr/fooproject.mine \\
72
73
takes_args = ['public_url?']
76
'Launchpad project short name to associate with the branch.',
75
'Launchpad product short name to associate with the branch.',
79
'Launchpad product short name to associate with the branch.',
77
82
Option('branch-name',
78
83
'Short name for the branch; '
79
84
'by default taken from the last component of the url.',
116
122
public_url = b.get_public_branch()
117
123
if public_url is None:
118
124
raise NoPublicBranch(b)
125
if product is not None:
127
trace.note('--product is deprecated; please use --project.')
120
130
rego = BranchRegistrationRequest(branch_url=public_url,
121
131
branch_name=branch_name,
122
132
branch_title=branch_title,
123
133
branch_description=branch_description,
124
product_name=product,
134
product_name=project,
125
135
author_email=author,
127
137
linko = BranchBugLinkRequest(branch_url=public_url,
184
194
web_url = self._get_web_url(LaunchpadService(), location)
185
195
trace.note('Opening %s in web browser' % web_url)
197
import webbrowser # this import should not be lazy
198
# otherwise bzr.exe lacks this module
187
199
webbrowser.open(web_url)
189
201
register_command(cmd_launchpad_open)
208
220
aliases = ['lp-login']
209
221
takes_args = ['name?']
210
222
takes_options = [
211
224
Option('no-check',
212
225
"Don't check that the user name is valid."),
215
def run(self, name=None, no_check=False):
228
def run(self, name=None, no_check=False, verbose=False):
216
229
from bzrlib.plugins.launchpad import account
217
230
check_account = not no_check
222
235
if check_account:
223
236
account.check_lp_login(username)
239
"Launchpad user ID exists and has SSH keys.\n")
224
240
self.outf.write(username + '\n')
226
242
self.outf.write('No Launchpad user ID configured.\n')
229
246
if check_account:
230
247
account.check_lp_login(name)
250
"Launchpad user ID exists and has SSH keys.\n")
231
251
account.set_lp_login(name)
253
self.outf.write("Launchpad user ID set to '%s'.\n" % (name,))
233
255
register_command(cmd_launchpad_login)
275
299
is then used by the 'lp:' transport to download your branches using
302
* The 'lp:' transport uses Launchpad as a directory service: for example
303
'lp:bzr' and 'lp:python' refer to the main branches of the relevant
304
projects and may be branched, logged, etc. You can also use the 'lp:'
305
transport to refer to specific branches, e.g. lp:~bzr/bzr/trunk.
307
* The 'lp:' bug tracker alias can expand launchpad bug numbers to their
308
URLs for use with 'bzr commit --fixes', e.g. 'bzr commit --fixes lp:12345'
309
will record a revision property that marks that revision as fixing
310
Launchpad bug 12345. When you push that branch to Launchpad it will
311
automatically be linked to the bug report.
278
313
* The register-branch command tells Launchpad about the url of a
279
314
public branch. Launchpad will then mirror the branch, display
280
315
its contents and allow it to be attached to bugs and other
283
* The 'lp:' transport uses Launchpad as a directory service: for example
284
'lp:bzr' and 'lp:python' refer to the main branches of the relevant
285
projects and may be branched, logged, etc. You can also use the 'lp:'
286
transport to refer to specific branches, e.g. lp:///~bzr/bzr/trunk.
288
318
For more information see http://help.launchpad.net/
290
320
topic_registry.register('launchpad',