4763.2.4
by John Arbash Meinel
merge bzr.2.1 in preparation for NEWS entry. |
1 |
# Copyright (C) 2006-2010 Canonical Ltd
|
0.4.1
by Martin Pool
Start lp-register command |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
0.4.1
by Martin Pool
Start lp-register command |
16 |
|
2898.3.8
by James Henstridge
Get rid of relative imports in Launchpad plugin. |
17 |
"""Launchpad.net integration plugin for Bazaar."""
|
0.4.1
by Martin Pool
Start lp-register command |
18 |
|
0.4.17
by Martin Pool
Allow xmlrpc service url to be overridden by $BZR_LP_XMLRPC_URL |
19 |
# The XMLRPC server address can be overridden by setting the environment
|
5053.1.1
by Martin Pool
Merge 2.1 back to trunk |
20 |
# variable $BZR_LP_XMLRPC_URL
|
0.4.17
by Martin Pool
Allow xmlrpc service url to be overridden by $BZR_LP_XMLRPC_URL |
21 |
|
0.4.9
by Martin Pool
Don't transmit non-standard xmlrpc <nil> value. |
22 |
# see http://bazaar-vcs.org/Specs/BranchRegistrationTool
|
23 |
||
4283.3.1
by Vincent Ladeuil
Make built-in plugins display the same version than bzrlib. |
24 |
# Since we are a built-in plugin we share the bzrlib version
|
25 |
from bzrlib import version_info |
|
26 |
||
4031.2.11
by John Arbash Meinel
Turn a bunch of imports into lazy imports. |
27 |
from bzrlib.lazy_import import lazy_import |
28 |
lazy_import(globals(), """ |
|
29 |
from bzrlib import (
|
|
30 |
branch as _mod_branch,
|
|
31 |
trace,
|
|
32 |
)
|
|
33 |
""") |
|
34 |
||
4969.2.7
by Aaron Bentley
Add lp-submit, get working. |
35 |
from bzrlib import bzrdir |
36 |
from bzrlib.commands import ( |
|
37 |
Command, |
|
38 |
register_command, |
|
39 |
)
|
|
3251.4.1
by Aaron Bentley
Convert LP transport into directory service |
40 |
from bzrlib.directory_service import directories |
4031.2.5
by Jonathan Lange
Refactor the code so we don't do too many remote requests. |
41 |
from bzrlib.errors import ( |
42 |
BzrCommandError, |
|
4505.6.25
by Jonathan Lange
Add a test to check what happens if launchpadlib not available. |
43 |
DependencyNotPresent, |
4031.2.5
by Jonathan Lange
Refactor the code so we don't do too many remote requests. |
44 |
InvalidURL, |
45 |
NoPublicBranch, |
|
46 |
NotBranchError, |
|
47 |
)
|
|
2245.8.6
by Martin Pool
Documentation under 'help launchpad' |
48 |
from bzrlib.help_topics import topic_registry |
4969.2.7
by Aaron Bentley
Add lp-submit, get working. |
49 |
from bzrlib.option import ( |
4969.2.10
by Aaron Bentley
Cleanup and docs. |
50 |
Option, |
4969.2.7
by Aaron Bentley
Add lp-submit, get working. |
51 |
ListOption, |
52 |
)
|
|
0.4.4
by Martin Pool
Start forming xmlrpc requests |
53 |
|
54 |
||
0.4.2
by Martin Pool
Rename command to 'register-branch' |
55 |
class cmd_register_branch(Command): |
56 |
"""Register a branch with launchpad.net.
|
|
0.4.1
by Martin Pool
Start lp-register command |
57 |
|
58 |
This command lists a bzr branch in the directory of branches on
|
|
2400.2.4
by Robert Collins
(robertc) Typo in the help for ``register-branch`` fixed. (Robert Collins, #96770) |
59 |
launchpad.net. Registration allows the branch to be associated with
|
0.4.1
by Martin Pool
Start lp-register command |
60 |
bugs or specifications.
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
61 |
|
4416.7.1
by Neil Martinsen-Burrell
Fix 238764 refer to projects rather than products in launchpad plugin |
62 |
Before using this command you must register the project to which the
|
0.4.1
by Martin Pool
Start lp-register command |
63 |
branch belongs, and create an account for yourself on launchpad.net.
|
0.4.3
by Martin Pool
More command line processing |
64 |
|
65 |
arguments:
|
|
3200.2.3
by Robert Collins
Tweak wording. |
66 |
public_url: The publicly visible url for the branch to register.
|
3200.2.1
by Robert Collins
* The ``register-branch`` command will now use the public url of the branch |
67 |
This must be an http or https url (which Launchpad can read
|
68 |
from to access the branch). Local file urls, SFTP urls, and
|
|
69 |
bzr+ssh urls will not work.
|
|
70 |
If no public_url is provided, bzr will use the configured
|
|
3200.2.3
by Robert Collins
Tweak wording. |
71 |
public_url if there is one for the current branch, and
|
72 |
otherwise error.
|
|
0.4.3
by Martin Pool
More command line processing |
73 |
|
74 |
example:
|
|
4416.7.1
by Neil Martinsen-Burrell
Fix 238764 refer to projects rather than products in launchpad plugin |
75 |
bzr register-branch http://foo.com/bzr/fooproject.mine \\
|
76 |
--project fooproject
|
|
0.4.1
by Martin Pool
Start lp-register command |
77 |
"""
|
3200.2.1
by Robert Collins
* The ``register-branch`` command will now use the public url of the branch |
78 |
takes_args = ['public_url?'] |
2598.1.1
by Martin Pool
Add test for and documentation of option style, fix up existing options to comply |
79 |
takes_options = [ |
4416.7.1
by Neil Martinsen-Burrell
Fix 238764 refer to projects rather than products in launchpad plugin |
80 |
Option('project', |
81 |
'Launchpad project short name to associate with the branch.', |
|
0.4.15
by Martin Pool
(register-branch) Add command-line options |
82 |
unicode), |
4416.7.3
by Neil Martinsen-Burrell
Retain --product options for register-branch, but deprecate it in favor of --project |
83 |
Option('product', |
84 |
'Launchpad product short name to associate with the branch.', |
|
85 |
unicode, |
|
86 |
hidden=True), |
|
0.4.15
by Martin Pool
(register-branch) Add command-line options |
87 |
Option('branch-name', |
2598.1.1
by Martin Pool
Add test for and documentation of option style, fix up existing options to comply |
88 |
'Short name for the branch; '
|
89 |
'by default taken from the last component of the url.', |
|
0.4.15
by Martin Pool
(register-branch) Add command-line options |
90 |
unicode), |
91 |
Option('branch-title', |
|
2598.1.1
by Martin Pool
Add test for and documentation of option style, fix up existing options to comply |
92 |
'One-sentence description of the branch.', |
0.4.15
by Martin Pool
(register-branch) Add command-line options |
93 |
unicode), |
94 |
Option('branch-description', |
|
2598.1.5
by Martin Pool
Fix one more option message. |
95 |
'Longer description of the purpose or contents of the branch.', |
0.4.15
by Martin Pool
(register-branch) Add command-line options |
96 |
unicode), |
2598.1.1
by Martin Pool
Add test for and documentation of option style, fix up existing options to comply |
97 |
Option('author', |
98 |
"Branch author's email address, if not yourself.", |
|
0.4.16
by Martin Pool
(register-branch) Add --author option and respect --dry-run |
99 |
unicode), |
0.4.19
by test at canonical
add possibility to link to a bug when registering a branch. factor out some common functionality from BranchRegistrationRequest. |
100 |
Option('link-bug', |
2598.1.1
by Martin Pool
Add test for and documentation of option style, fix up existing options to comply |
101 |
'The bug this branch fixes.', |
0.4.19
by test at canonical
add possibility to link to a bug when registering a branch. factor out some common functionality from BranchRegistrationRequest. |
102 |
int), |
0.4.15
by Martin Pool
(register-branch) Add command-line options |
103 |
Option('dry-run', |
2598.1.1
by Martin Pool
Add test for and documentation of option style, fix up existing options to comply |
104 |
'Prepare the request but don\'t actually send it.') |
0.4.15
by Martin Pool
(register-branch) Add command-line options |
105 |
]
|
106 |
||
107 |
||
3200.2.1
by Robert Collins
* The ``register-branch`` command will now use the public url of the branch |
108 |
def run(self, |
109 |
public_url=None, |
|
4416.7.1
by Neil Martinsen-Burrell
Fix 238764 refer to projects rather than products in launchpad plugin |
110 |
project='', |
4416.7.3
by Neil Martinsen-Burrell
Retain --product options for register-branch, but deprecate it in favor of --project |
111 |
product=None, |
0.4.15
by Martin Pool
(register-branch) Add command-line options |
112 |
branch_name='', |
113 |
branch_title='', |
|
114 |
branch_description='', |
|
0.4.16
by Martin Pool
(register-branch) Add --author option and respect --dry-run |
115 |
author='', |
0.4.19
by test at canonical
add possibility to link to a bug when registering a branch. factor out some common functionality from BranchRegistrationRequest. |
116 |
link_bug=None, |
0.4.15
by Martin Pool
(register-branch) Add command-line options |
117 |
dry_run=False): |
2898.3.8
by James Henstridge
Get rid of relative imports in Launchpad plugin. |
118 |
from bzrlib.plugins.launchpad.lp_registration import ( |
4505.6.4
by Jonathan Lange
Remove unnecessary import. |
119 |
BranchRegistrationRequest, BranchBugLinkRequest, |
4505.6.10
by Jonathan Lange
Move lp_registration imports into commands. |
120 |
DryRunLaunchpadService, LaunchpadService) |
3200.2.1
by Robert Collins
* The ``register-branch`` command will now use the public url of the branch |
121 |
if public_url is None: |
122 |
try: |
|
4031.2.11
by John Arbash Meinel
Turn a bunch of imports into lazy imports. |
123 |
b = _mod_branch.Branch.open_containing('.')[0] |
3200.2.1
by Robert Collins
* The ``register-branch`` command will now use the public url of the branch |
124 |
except NotBranchError: |
125 |
raise BzrCommandError('register-branch requires a public ' |
|
126 |
'branch url - see bzr help register-branch.') |
|
127 |
public_url = b.get_public_branch() |
|
128 |
if public_url is None: |
|
129 |
raise NoPublicBranch(b) |
|
4416.7.3
by Neil Martinsen-Burrell
Retain --product options for register-branch, but deprecate it in favor of --project |
130 |
if product is not None: |
131 |
project = product |
|
132 |
trace.note('--product is deprecated; please use --project.') |
|
133 |
||
3200.2.1
by Robert Collins
* The ``register-branch`` command will now use the public url of the branch |
134 |
|
135 |
rego = BranchRegistrationRequest(branch_url=public_url, |
|
0.4.15
by Martin Pool
(register-branch) Add command-line options |
136 |
branch_name=branch_name, |
137 |
branch_title=branch_title, |
|
138 |
branch_description=branch_description, |
|
4416.7.1
by Neil Martinsen-Burrell
Fix 238764 refer to projects rather than products in launchpad plugin |
139 |
product_name=project, |
0.4.16
by Martin Pool
(register-branch) Add --author option and respect --dry-run |
140 |
author_email=author, |
0.4.15
by Martin Pool
(register-branch) Add command-line options |
141 |
)
|
3200.2.1
by Robert Collins
* The ``register-branch`` command will now use the public url of the branch |
142 |
linko = BranchBugLinkRequest(branch_url=public_url, |
0.4.19
by test at canonical
add possibility to link to a bug when registering a branch. factor out some common functionality from BranchRegistrationRequest. |
143 |
bug_id=link_bug) |
1668.1.12
by Martin Pool
(launchpad plugin) Improved --dry-run that uses a dummy xmlrpc service. |
144 |
if not dry_run: |
145 |
service = LaunchpadService() |
|
146 |
# This gives back the xmlrpc url that can be used for future
|
|
147 |
# operations on the branch. It's not so useful to print to the
|
|
148 |
# user since they can't do anything with it from a web browser; it
|
|
149 |
# might be nice for the server to tell us about an html url as
|
|
150 |
# well.
|
|
151 |
else: |
|
152 |
# Run on service entirely in memory
|
|
153 |
service = DryRunLaunchpadService() |
|
0.4.19
by test at canonical
add possibility to link to a bug when registering a branch. factor out some common functionality from BranchRegistrationRequest. |
154 |
service.gather_user_credentials() |
4505.6.21
by Jonathan Lange
Clean up flakes. |
155 |
rego.submit(service) |
1668.1.12
by Martin Pool
(launchpad plugin) Improved --dry-run that uses a dummy xmlrpc service. |
156 |
if link_bug: |
4505.6.21
by Jonathan Lange
Clean up flakes. |
157 |
linko.submit(service) |
1668.1.12
by Martin Pool
(launchpad plugin) Improved --dry-run that uses a dummy xmlrpc service. |
158 |
print 'Branch registered.' |
0.4.1
by Martin Pool
Start lp-register command |
159 |
|
0.4.2
by Martin Pool
Rename command to 'register-branch' |
160 |
register_command(cmd_register_branch) |
2245.8.4
by Martin Pool
lp:/// indirection works |
161 |
|
2898.3.3
by James Henstridge
Add launchpad-login command. |
162 |
|
3955.3.5
by Jonathan Lange
Add an untested plugin, make the error handling a little nicer. |
163 |
class cmd_launchpad_open(Command): |
164 |
"""Open a Launchpad branch page in your web browser."""
|
|
165 |
||
166 |
aliases = ['lp-open'] |
|
3955.3.7
by Jonathan Lange
Test the launchpad-open command. Fix up some minor bugs. |
167 |
takes_options = [ |
168 |
Option('dry-run', |
|
169 |
'Do not actually open the browser. Just say the URL we would '
|
|
170 |
'use.'), |
|
171 |
]
|
|
3955.3.5
by Jonathan Lange
Add an untested plugin, make the error handling a little nicer. |
172 |
takes_args = ['location?'] |
173 |
||
4031.2.5
by Jonathan Lange
Refactor the code so we don't do too many remote requests. |
174 |
def _possible_locations(self, location): |
175 |
"""Yield possible external locations for the branch at 'location'."""
|
|
176 |
yield location |
|
177 |
try: |
|
4867.2.1
by Neil Martinsen-Burrell
launchpad-open works from a subdirectory of a branch |
178 |
branch = _mod_branch.Branch.open_containing(location)[0] |
4031.2.5
by Jonathan Lange
Refactor the code so we don't do too many remote requests. |
179 |
except NotBranchError: |
180 |
return
|
|
181 |
branch_url = branch.get_public_branch() |
|
182 |
if branch_url is not None: |
|
183 |
yield branch_url |
|
184 |
branch_url = branch.get_push_location() |
|
185 |
if branch_url is not None: |
|
186 |
yield branch_url |
|
187 |
||
188 |
def _get_web_url(self, service, location): |
|
4505.6.10
by Jonathan Lange
Move lp_registration imports into commands. |
189 |
from bzrlib.plugins.launchpad.lp_registration import ( |
190 |
NotLaunchpadBranch) |
|
4031.2.5
by Jonathan Lange
Refactor the code so we don't do too many remote requests. |
191 |
for branch_url in self._possible_locations(location): |
192 |
try: |
|
193 |
return service.get_web_url_from_branch_url(branch_url) |
|
194 |
except (NotLaunchpadBranch, InvalidURL): |
|
195 |
pass
|
|
196 |
raise NotLaunchpadBranch(branch_url) |
|
197 |
||
3955.3.7
by Jonathan Lange
Test the launchpad-open command. Fix up some minor bugs. |
198 |
def run(self, location=None, dry_run=False): |
4505.6.10
by Jonathan Lange
Move lp_registration imports into commands. |
199 |
from bzrlib.plugins.launchpad.lp_registration import ( |
200 |
LaunchpadService) |
|
3955.3.5
by Jonathan Lange
Add an untested plugin, make the error handling a little nicer. |
201 |
if location is None: |
202 |
location = u'.' |
|
4505.6.21
by Jonathan Lange
Clean up flakes. |
203 |
web_url = self._get_web_url(LaunchpadService(), location) |
4031.2.11
by John Arbash Meinel
Turn a bunch of imports into lazy imports. |
204 |
trace.note('Opening %s in web browser' % web_url) |
3955.3.7
by Jonathan Lange
Test the launchpad-open command. Fix up some minor bugs. |
205 |
if not dry_run: |
4511.1.1
by Alexander Belchenko
launchpad plugin: import webbrowse should be explicit and never lazy, otherwise bzr.exe lacks this module. |
206 |
import webbrowser # this import should not be lazy |
207 |
# otherwise bzr.exe lacks this module
|
|
3955.3.7
by Jonathan Lange
Test the launchpad-open command. Fix up some minor bugs. |
208 |
webbrowser.open(web_url) |
3955.3.5
by Jonathan Lange
Add an untested plugin, make the error handling a little nicer. |
209 |
|
210 |
register_command(cmd_launchpad_open) |
|
211 |
||
212 |
||
2898.3.3
by James Henstridge
Add launchpad-login command. |
213 |
class cmd_launchpad_login(Command): |
2934.1.1
by Ian Clatworthy
(James Henstridge) add a command for managing the Launchpad user ID |
214 |
"""Show or set the Launchpad user ID.
|
2898.3.3
by James Henstridge
Add launchpad-login command. |
215 |
|
216 |
When communicating with Launchpad, some commands need to know your
|
|
217 |
Launchpad user ID. This command can be used to set or show the
|
|
218 |
user ID that Bazaar will use for such communication.
|
|
219 |
||
220 |
:Examples:
|
|
221 |
Show the Launchpad ID of the current user::
|
|
222 |
||
223 |
bzr launchpad-login
|
|
224 |
||
2898.3.9
by James Henstridge
* Add a simple NEWS item for the command. |
225 |
Set the Launchpad ID of the current user to 'bob'::
|
2898.3.3
by James Henstridge
Add launchpad-login command. |
226 |
|
2898.3.9
by James Henstridge
* Add a simple NEWS item for the command. |
227 |
bzr launchpad-login bob
|
2898.3.3
by James Henstridge
Add launchpad-login command. |
228 |
"""
|
229 |
aliases = ['lp-login'] |
|
230 |
takes_args = ['name?'] |
|
231 |
takes_options = [ |
|
4505.1.2
by Jonathan Lange
Add many more tests, fix the actual bug. |
232 |
'verbose', |
2898.3.4
by James Henstridge
Cleanups from mini-review by Tim. |
233 |
Option('no-check', |
234 |
"Don't check that the user name is valid."), |
|
2898.3.3
by James Henstridge
Add launchpad-login command. |
235 |
]
|
236 |
||
4505.1.2
by Jonathan Lange
Add many more tests, fix the actual bug. |
237 |
def run(self, name=None, no_check=False, verbose=False): |
4505.6.13
by Jonathan Lange
Clarify the comment. |
238 |
# This is totally separate from any launchpadlib login system.
|
2898.3.8
by James Henstridge
Get rid of relative imports in Launchpad plugin. |
239 |
from bzrlib.plugins.launchpad import account |
2898.3.3
by James Henstridge
Add launchpad-login command. |
240 |
check_account = not no_check |
241 |
||
242 |
if name is None: |
|
243 |
username = account.get_lp_login() |
|
244 |
if username: |
|
2898.3.4
by James Henstridge
Cleanups from mini-review by Tim. |
245 |
if check_account: |
246 |
account.check_lp_login(username) |
|
4505.1.3
by Jonathan Lange
Add some extra untested verbosity. |
247 |
if verbose: |
248 |
self.outf.write( |
|
249 |
"Launchpad user ID exists and has SSH keys.\n") |
|
2898.3.3
by James Henstridge
Add launchpad-login command. |
250 |
self.outf.write(username + '\n') |
251 |
else: |
|
252 |
self.outf.write('No Launchpad user ID configured.\n') |
|
2898.3.9
by James Henstridge
* Add a simple NEWS item for the command. |
253 |
return 1 |
2898.3.3
by James Henstridge
Add launchpad-login command. |
254 |
else: |
4216.2.1
by Michael Hudson
well this is it |
255 |
name = name.lower() |
2898.3.3
by James Henstridge
Add launchpad-login command. |
256 |
if check_account: |
257 |
account.check_lp_login(name) |
|
4505.1.3
by Jonathan Lange
Add some extra untested verbosity. |
258 |
if verbose: |
259 |
self.outf.write( |
|
260 |
"Launchpad user ID exists and has SSH keys.\n") |
|
2898.3.3
by James Henstridge
Add launchpad-login command. |
261 |
account.set_lp_login(name) |
4505.1.2
by Jonathan Lange
Add many more tests, fix the actual bug. |
262 |
if verbose: |
263 |
self.outf.write("Launchpad user ID set to '%s'.\n" % (name,)) |
|
2898.3.3
by James Henstridge
Add launchpad-login command. |
264 |
|
265 |
register_command(cmd_launchpad_login) |
|
266 |
||
267 |
||
4505.6.9
by Jonathan Lange
Add some XXX comments based on the review. |
268 |
# XXX: cmd_launchpad_mirror is untested
|
4505.6.6
by Jonathan Lange
Add a command to mirror Launchpad branches now. |
269 |
class cmd_launchpad_mirror(Command): |
270 |
"""Ask Launchpad to mirror a branch now."""
|
|
271 |
||
272 |
aliases = ['lp-mirror'] |
|
273 |
takes_args = ['location?'] |
|
274 |
||
275 |
def run(self, location='.'): |
|
4505.6.25
by Jonathan Lange
Add a test to check what happens if launchpadlib not available. |
276 |
from bzrlib.plugins.launchpad import lp_api |
4505.6.10
by Jonathan Lange
Move lp_registration imports into commands. |
277 |
from bzrlib.plugins.launchpad.lp_registration import LaunchpadService |
4505.6.30
by Jonathan Lange
Add basic smoke tests to show that the command exists. |
278 |
branch = _mod_branch.Branch.open(location) |
4505.6.6
by Jonathan Lange
Add a command to mirror Launchpad branches now. |
279 |
service = LaunchpadService() |
280 |
launchpad = lp_api.login(service) |
|
281 |
lp_branch = lp_api.load_branch(launchpad, branch) |
|
282 |
lp_branch.requestMirror() |
|
283 |
||
284 |
||
4505.6.8
by Jonathan Lange
Always register the lp-mirror command. Only try to load launchpadlib if |
285 |
register_command(cmd_launchpad_mirror) |
4505.6.6
by Jonathan Lange
Add a command to mirror Launchpad branches now. |
286 |
|
287 |
||
4969.2.16
by Aaron Bentley
Updates from review. |
288 |
class cmd_lp_propose_merge(Command): |
289 |
"""Propose merging a branch on Launchpad.
|
|
290 |
||
291 |
This will open your usual editor to provide the initial comment. When it
|
|
4969.2.19
by Aaron Bentley
Rename submit to propose everywhere. |
292 |
has created the proposal, it will open it in your default web browser.
|
4969.2.16
by Aaron Bentley
Updates from review. |
293 |
|
294 |
The branch will be proposed to merge into SUBMIT_BRANCH. If SUBMIT_BRANCH
|
|
295 |
is not supplied, the remembered submit branch will be used. If no submit
|
|
296 |
branch is remembered, the development focus will be used.
|
|
297 |
||
298 |
By default, the SUBMIT_BRANCH's review team will be requested to review
|
|
299 |
the merge proposal. This can be overriden by specifying --review (-R).
|
|
300 |
The parameter the launchpad account name of the desired reviewer. This
|
|
301 |
may optionally be followed by '=' and the review type. For example:
|
|
302 |
||
303 |
bzr lp-propose-merge --review jrandom --review review-team=qa
|
|
304 |
||
305 |
This will propose a merge, request "jrandom" to perform a review of
|
|
306 |
unspecified type, and request "review-team" to perform a "qa" review.
|
|
307 |
"""
|
|
4969.2.7
by Aaron Bentley
Add lp-submit, get working. |
308 |
|
309 |
takes_options = [Option('staging', |
|
310 |
help='Propose the merge on staging.'), |
|
311 |
Option('message', short_name='m', type=unicode, |
|
312 |
help='Commit message.'), |
|
313 |
ListOption('review', short_name='R', type=unicode, |
|
314 |
help='Requested reviewer and optional type.')] |
|
315 |
||
316 |
takes_args = ['submit_branch?'] |
|
317 |
||
4969.2.16
by Aaron Bentley
Updates from review. |
318 |
aliases = ['lp-submit', 'lp-propose'] |
319 |
||
4969.2.7
by Aaron Bentley
Add lp-submit, get working. |
320 |
def run(self, submit_branch=None, review=None, staging=False, |
321 |
message=None): |
|
4969.2.19
by Aaron Bentley
Rename submit to propose everywhere. |
322 |
from bzrlib.plugins.launchpad import lp_propose |
4969.2.7
by Aaron Bentley
Add lp-submit, get working. |
323 |
tree, branch, relpath = bzrdir.BzrDir.open_containing_tree_or_branch( |
324 |
'.') |
|
325 |
if review is None: |
|
326 |
reviews = None |
|
327 |
else: |
|
328 |
reviews = [] |
|
329 |
for review in review: |
|
330 |
if '=' in review: |
|
331 |
reviews.append(review.split('=', 2)) |
|
332 |
else: |
|
333 |
reviews.append((review, '')) |
|
334 |
if submit_branch is None: |
|
335 |
submit_branch = branch.get_submit_branch() |
|
336 |
if submit_branch is None: |
|
337 |
target = None |
|
338 |
else: |
|
339 |
target = _mod_branch.Branch.open(submit_branch) |
|
4969.2.19
by Aaron Bentley
Rename submit to propose everywhere. |
340 |
proposer = lp_propose.Proposer(tree, branch, target, message, |
341 |
reviews, staging) |
|
342 |
proposer.check_proposal() |
|
343 |
proposer.create_proposal() |
|
4969.2.7
by Aaron Bentley
Add lp-submit, get working. |
344 |
|
345 |
||
4969.2.16
by Aaron Bentley
Updates from review. |
346 |
register_command(cmd_lp_propose_merge) |
4969.2.7
by Aaron Bentley
Add lp-submit, get working. |
347 |
|
348 |
||
3251.4.2
by Aaron Bentley
Clean up Launchpad directory service code |
349 |
def _register_directory(): |
3251.4.3
by Aaron Bentley
More renames and cleanups |
350 |
directories.register_lazy('lp:', 'bzrlib.plugins.launchpad.lp_directory', |
3251.4.2
by Aaron Bentley
Clean up Launchpad directory service code |
351 |
'LaunchpadDirectory', |
352 |
'Launchpad-based directory service',) |
|
353 |
_register_directory() |
|
2245.8.5
by Martin Pool
Add short-form lp:PRODUCT url form |
354 |
|
0.4.1
by Martin Pool
Start lp-register command |
355 |
|
4776.2.2
by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers. |
356 |
def load_tests(basic_tests, module, loader): |
357 |
testmod_names = [ |
|
358 |
'test_account', |
|
359 |
'test_register', |
|
4505.6.25
by Jonathan Lange
Add a test to check what happens if launchpadlib not available. |
360 |
'test_lp_api', |
4776.2.2
by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers. |
361 |
'test_lp_directory', |
362 |
'test_lp_login', |
|
363 |
'test_lp_open', |
|
364 |
'test_lp_service', |
|
365 |
]
|
|
366 |
basic_tests.addTest(loader.loadTestsFromModuleNames( |
|
367 |
["%s.%s" % (__name__, tmn) for tmn in testmod_names])) |
|
368 |
return basic_tests |
|
2245.8.1
by Martin Pool
Start adding tests for launchpad indirection |
369 |
|
2245.8.6
by Martin Pool
Documentation under 'help launchpad' |
370 |
|
371 |
_launchpad_help = """Integration with Launchpad.net |
|
372 |
||
373 |
Launchpad.net provides free Bazaar branch hosting with integrated bug and
|
|
374 |
specification tracking.
|
|
375 |
||
3031.1.1
by jml at canonical
Expand the documentation on lp:// URLs and mention the launchpad-login command. |
376 |
The bzr client (through the plugin called 'launchpad') has special
|
2245.8.6
by Martin Pool
Documentation under 'help launchpad' |
377 |
features to communicate with Launchpad:
|
378 |
||
3031.1.1
by jml at canonical
Expand the documentation on lp:// URLs and mention the launchpad-login command. |
379 |
* The launchpad-login command tells Bazaar your Launchpad user name. This
|
380 |
is then used by the 'lp:' transport to download your branches using
|
|
381 |
bzr+ssh://.
|
|
382 |
||
4258.1.1
by James Westby
Add "--fixes lp:" to the launchpad plugin documentation. |
383 |
* The 'lp:' transport uses Launchpad as a directory service: for example
|
384 |
'lp:bzr' and 'lp:python' refer to the main branches of the relevant
|
|
385 |
projects and may be branched, logged, etc. You can also use the 'lp:'
|
|
386 |
transport to refer to specific branches, e.g. lp:~bzr/bzr/trunk.
|
|
387 |
||
388 |
* The 'lp:' bug tracker alias can expand launchpad bug numbers to their
|
|
389 |
URLs for use with 'bzr commit --fixes', e.g. 'bzr commit --fixes lp:12345'
|
|
390 |
will record a revision property that marks that revision as fixing
|
|
4258.1.2
by Matt Nordhoff
Fix a typo in the launchpad plugin's help |
391 |
Launchpad bug 12345. When you push that branch to Launchpad it will
|
392 |
automatically be linked to the bug report.
|
|
4258.1.1
by James Westby
Add "--fixes lp:" to the launchpad plugin documentation. |
393 |
|
3031.1.1
by jml at canonical
Expand the documentation on lp:// URLs and mention the launchpad-login command. |
394 |
* The register-branch command tells Launchpad about the url of a
|
2245.8.6
by Martin Pool
Documentation under 'help launchpad' |
395 |
public branch. Launchpad will then mirror the branch, display
|
3031.1.1
by jml at canonical
Expand the documentation on lp:// URLs and mention the launchpad-login command. |
396 |
its contents and allow it to be attached to bugs and other
|
2245.8.6
by Martin Pool
Documentation under 'help launchpad' |
397 |
objects.
|
398 |
||
399 |
For more information see http://help.launchpad.net/
|
|
400 |
"""
|
|
401 |
topic_registry.register('launchpad', |
|
402 |
_launchpad_help, |
|
403 |
'Using Bazaar with Launchpad.net') |