Rev 3211: (robertc) Fix register-branch for launchpad beta group team members in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Feb 1 05:39:44 GMT 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3211
revision-id:pqm at pqm.ubuntu.com-20080201053934-q32y2nk5vvo13c6v
parent: pqm at pqm.ubuntu.com-20080201034612-xl88s8i45res3pm2
parent: robertc at robertcollins.net-20080201040133-7gc0fxqh3b8ot84x
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2008-02-01 05:39:34 +0000
message:
(robertc) Fix register-branch for launchpad beta group team members
and teach it to use the public location of the current branch
by default. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/plugins/launchpad/__init__.py __init__.py-20060315182712-2d5feebd2a1032dc
bzrlib/plugins/launchpad/lp_registration.py lp_registration.py-20060315190948-daa617eafe3a8d48
bzrlib/plugins/launchpad/test_register.py test_register.py-20060315182712-40f5dda945c829a8
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
------------------------------------------------------------
revno: 3200.2.5
revision-id:robertc at robertcollins.net-20080201040133-7gc0fxqh3b8ot84x
parent: robertc at robertcollins.net-20080201035953-zxrnzhnb1xv0nolj
parent: pqm at pqm.ubuntu.com-20080130212051-utcw5p2zydlq6ntb
committer: Robert Collins <robertc at robertcollins.net>
branch nick: register-branch.public_location
timestamp: Fri 2008-02-01 15:01:33 +1100
message:
Merge bzr.dev to resolve conflicts with register-branch NEWS items.
removed:
bzrlib/plugins/multiparent.py mpregen-20070411063203-5x9z7i73add0d6f6-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/annotate.py annotate.py-20050922133147-7c60541d2614f022
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/graph.py graph_walker.py-20070525030359-y852guab65d4wtn0-1
bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/plugin.py plugin.py-20050622060424-829b654519533d69
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/status.py status.py-20050505062338-431bfa63ec9b19e6
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/test_outside_wt.py test_outside_wt.py-20060116200058-98edd33e7db8bdde
bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/test_diff.py testdiff.py-20050727164403-d1a3496ebb12e339
bzrlib/tests/test_http.py testhttp.py-20051018020158-b2eef6e867c514d9
bzrlib/tests/test_merge.py testmerge.py-20050905070950-c1b5aa49ff911024
bzrlib/tests/test_nonascii.py testnonascii.py-20051018022645-ea1d8b6477b058a6
bzrlib/tests/test_plugins.py plugins.py-20050622075746-32002b55e5e943e9
bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/tests/workingtree_implementations/test_rename_one.py test_rename_one.py-20070226161242-2d8ibdedl700jgio-1
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
------------------------------------------------------------
revno: 3200.2.4
revision-id:robertc at robertcollins.net-20080201035953-zxrnzhnb1xv0nolj
parent: robertc at robertcollins.net-20080125115256-1bayb034r2wtbbs4
committer: Robert Collins <robertc at robertcollins.net>
branch nick: register-branch.public_location
timestamp: Fri 2008-02-01 14:59:53 +1100
message:
Update NEWS.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3200.2.3
revision-id:robertc at robertcollins.net-20080125115256-1bayb034r2wtbbs4
parent: robertc at robertcollins.net-20080125110632-0tp2cjae2ol63zuq
committer: Robert Collins <robertc at robertcollins.net>
branch nick: register-branch.public_location
timestamp: Fri 2008-01-25 22:52:56 +1100
message:
Tweak wording.
modified:
bzrlib/plugins/launchpad/__init__.py __init__.py-20060315182712-2d5feebd2a1032dc
------------------------------------------------------------
revno: 3200.2.2
revision-id:robertc at robertcollins.net-20080125110632-0tp2cjae2ol63zuq
parent: robertc at robertcollins.net-20080125104610-4qweeqqch2feyxdv
committer: Robert Collins <robertc at robertcollins.net>
branch nick: register-branch.public_location
timestamp: Fri 2008-01-25 22:06:32 +1100
message:
* The launchpad plugin now uses the ``edge`` xmlrpc server to avoid
interacting badly with a bug on the launchpad side. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/plugins/launchpad/lp_registration.py lp_registration.py-20060315190948-daa617eafe3a8d48
bzrlib/plugins/launchpad/test_register.py test_register.py-20060315182712-40f5dda945c829a8
------------------------------------------------------------
revno: 3200.2.1
revision-id:robertc at robertcollins.net-20080125104610-4qweeqqch2feyxdv
parent: pqm at pqm.ubuntu.com-20080124050323-gsgsp2em7v1ugtnz
committer: Robert Collins <robertc at robertcollins.net>
branch nick: register-branch.public_location
timestamp: Fri 2008-01-25 21:46:10 +1100
message:
* The ``register-branch`` command will now use the public url of the branch
containing the current directory, if one has been set and no explicit branch is provided.
(Robert Collins)
* New error ``NoPublicBranch`` for commands that need a public branch to
operate. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/plugins/launchpad/__init__.py __init__.py-20060315182712-2d5feebd2a1032dc
bzrlib/plugins/launchpad/lp_registration.py lp_registration.py-20060315190948-daa617eafe3a8d48
bzrlib/plugins/launchpad/test_register.py test_register.py-20060315182712-40f5dda945c829a8
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
=== modified file 'NEWS'
--- a/NEWS 2008-02-01 00:30:33 +0000
+++ b/NEWS 2008-02-01 05:39:34 +0000
@@ -43,6 +43,10 @@
* The ``--coverage`` option is now global, rather specific to ``bzr
selftest``. (Andrew Bennetts)
+ * The ``register-branch`` command will now use the public url of the branch
+ containing the current directory, if one has been set and no explicit
+ branch is provided. (Robert Collins)
+
* Tweak the ``reannotate`` code path to optimize the 2-parent case.
Speeds up ``bzr annotate`` with a pack repository by approx 3:2.
(John Arbash Meinel)
@@ -75,6 +79,9 @@
more characters which should be considered valid.
(John Arbash Meinel, #185458)
+ * The launchpad plugin now uses the ``edge`` xmlrpc server to avoid
+ interacting badly with a bug on the launchpad side. (Robert Collins)
+
* Unknown hostnames when connecting to a ``bzr://`` URL no longer cause
tracebacks. (Andrew Bennetts, #182849)
@@ -110,6 +117,9 @@
``InterRepository.search_missing_revision_ids`` which returns a
``bzrlib.graph.SearchResult`` suitable for making requests from the smart
server. (Robert Collins)
+
+ * New error ``NoPublicBranch`` for commands that need a public branch to
+ operate. (Robert Collins)
* New method ``iter_inventories`` on Repository for access to many
inventories. This is primarily used by the ``revision_trees`` method, as
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2008-01-11 05:08:20 +0000
+++ b/bzrlib/errors.py 2008-01-25 10:46:10 +0000
@@ -267,6 +267,16 @@
"record_entry_contents.")
+class NoPublicBranch(BzrError):
+
+ _fmt = 'There is no public branch set for "%(branch_url)s".'
+
+ def __init__(self, branch):
+ import bzrlib.urlutils as urlutils
+ public_location = urlutils.unescape_for_display(branch.base, 'ascii')
+ BzrError.__init__(self, branch_url=public_location)
+
+
class NoHelpTopic(BzrError):
_fmt = ("No help could be found for '%(topic)s'. "
=== modified file 'bzrlib/plugins/launchpad/__init__.py'
--- a/bzrlib/plugins/launchpad/__init__.py 2007-11-27 00:50:43 +0000
+++ b/bzrlib/plugins/launchpad/__init__.py 2008-01-25 11:52:56 +0000
@@ -21,7 +21,9 @@
# see http://bazaar-vcs.org/Specs/BranchRegistrationTool
+from bzrlib.branch import Branch
from bzrlib.commands import Command, Option, register_command
+from bzrlib.errors import BzrCommandError, NoPublicBranch, NotBranchError
from bzrlib.transport import register_lazy_transport
from bzrlib.help_topics import topic_registry
@@ -37,15 +39,19 @@
branch belongs, and create an account for yourself on launchpad.net.
arguments:
- branch_url: The publicly visible url for the branch.
- This must be an http or https url, not a local file
- path.
+ public_url: The publicly visible url for the branch to register.
+ This must be an http or https url (which Launchpad can read
+ from to access the branch). Local file urls, SFTP urls, and
+ bzr+ssh urls will not work.
+ If no public_url is provided, bzr will use the configured
+ public_url if there is one for the current branch, and
+ otherwise error.
example:
bzr register-branch http://foo.com/bzr/fooproduct.mine \\
--product fooproduct
"""
- takes_args = ['branch_url']
+ takes_args = ['public_url?']
takes_options = [
Option('product',
'Launchpad product short name to associate with the branch.',
@@ -71,8 +77,8 @@
]
- def run(self,
- branch_url,
+ def run(self,
+ public_url=None,
product='',
branch_name='',
branch_title='',
@@ -83,14 +89,24 @@
from bzrlib.plugins.launchpad.lp_registration import (
LaunchpadService, BranchRegistrationRequest, BranchBugLinkRequest,
DryRunLaunchpadService)
- rego = BranchRegistrationRequest(branch_url=branch_url,
+ if public_url is None:
+ try:
+ b = Branch.open_containing('.')[0]
+ except NotBranchError:
+ raise BzrCommandError('register-branch requires a public '
+ 'branch url - see bzr help register-branch.')
+ public_url = b.get_public_branch()
+ if public_url is None:
+ raise NoPublicBranch(b)
+
+ rego = BranchRegistrationRequest(branch_url=public_url,
branch_name=branch_name,
branch_title=branch_title,
branch_description=branch_description,
product_name=product,
author_email=author,
)
- linko = BranchBugLinkRequest(branch_url=branch_url,
+ linko = BranchBugLinkRequest(branch_url=public_url,
bug_id=link_bug)
if not dry_run:
service = LaunchpadService()
=== modified file 'bzrlib/plugins/launchpad/lp_registration.py'
--- a/bzrlib/plugins/launchpad/lp_registration.py 2007-11-14 15:03:18 +0000
+++ b/bzrlib/plugins/launchpad/lp_registration.py 2008-01-25 11:06:32 +0000
@@ -40,7 +40,11 @@
# NB: this should always end in a slash to avoid xmlrpclib appending
# '/RPC2'
- DEFAULT_SERVICE_URL = 'https://xmlrpc.launchpad.net/bazaar/'
+ # We use edge because:
+ # Beta users get redirected to it
+ # All users can use it
+ # There is a bug in the launchpad side where redirection causes an OOPS.
+ DEFAULT_SERVICE_URL = 'https://xmlrpc.edge.launchpad.net/bazaar/'
transport = None
registrant_email = None
@@ -180,7 +184,7 @@
author_email='',
product_name='',
):
- assert branch_url
+ assert branch_url, 'branch_url %r is invalid' % branch_url
self.branch_url = branch_url
if branch_name:
self.branch_name = branch_name
=== modified file 'bzrlib/plugins/launchpad/test_register.py'
--- a/bzrlib/plugins/launchpad/test_register.py 2007-11-14 15:03:18 +0000
+++ b/bzrlib/plugins/launchpad/test_register.py 2008-01-25 11:06:32 +0000
@@ -26,7 +26,7 @@
tests,
ui,
)
-from bzrlib.tests import TestCase, TestSkipped
+from bzrlib.tests import TestCaseWithTransport, TestSkipped
# local import
from bzrlib.plugins.launchpad.lp_registration import (
@@ -129,7 +129,7 @@
self.called_authenticated = authenticated
-class TestBranchRegistration(TestCase):
+class TestBranchRegistration(TestCaseWithTransport):
SAMPLE_URL = 'http://bazaar-vcs.org/bzr/bzr.dev/'
SAMPLE_OWNER = 'jhacker at foo.com'
SAMPLE_BRANCH_ID = 'bzr.dev'
@@ -144,9 +144,26 @@
out, err = self.run_bzr(['register-branch', '--help'])
self.assertContainsRe(out, r'Register a branch')
- def test_register_no_url(self):
+ def test_register_no_url_no_branch(self):
"""register-branch command requires parameters"""
- self.run_bzr('register-branch', retcode=3)
+ self.make_repository('.')
+ self.run_bzr_error(
+ ['register-branch requires a public branch url - '
+ 'see bzr help register-branch'],
+ 'register-branch')
+
+ def test_register_no_url_in_published_branch_no_error(self):
+ b = self.make_branch('.')
+ b.set_public_branch('http://test-server.com/bzr/branch')
+ out, err = self.run_bzr(['register-branch', '--dry-run'])
+ self.assertEqual('Branch registered.\n', out)
+ self.assertEqual('', err)
+
+ def test_register_no_url_in_unpublished_branch_errors(self):
+ b = self.make_branch('.')
+ out, err = self.run_bzr_error(['no public branch'],
+ ['register-branch', '--dry-run'])
+ self.assertEqual('', out)
def test_register_dry_run(self):
out, err = self.run_bzr(['register-branch',
@@ -168,7 +185,7 @@
'author at launchpad.net',
'product')
rego.submit(service)
- self.assertEquals(transport.connected_host, 'xmlrpc.launchpad.net')
+ self.assertEquals(transport.connected_host, 'xmlrpc.edge.launchpad.net')
self.assertEquals(len(transport.sent_params), 6)
self.assertEquals(transport.sent_params,
('http://test-server.com/bzr/branch', # branch_url
@@ -185,7 +202,7 @@
service = LaunchpadService(transport)
resolve = ResolveLaunchpadPathRequest('bzr')
resolve.submit(service)
- self.assertEquals(transport.connected_host, 'xmlrpc.launchpad.net')
+ self.assertEquals(transport.connected_host, 'xmlrpc.edge.launchpad.net')
self.assertEquals(len(transport.sent_params), 1)
self.assertEquals(transport.sent_params, ('bzr', ))
self.assertTrue(transport.got_request)
=== modified file 'bzrlib/tests/test_errors.py'
--- a/bzrlib/tests/test_errors.py 2008-01-02 03:08:59 +0000
+++ b/bzrlib/tests/test_errors.py 2008-01-25 10:46:10 +0000
@@ -22,6 +22,7 @@
bzrdir,
errors,
symbol_versioning,
+ urlutils,
)
from bzrlib.tests import TestCase, TestCaseWithTransport
@@ -121,7 +122,14 @@
error = errors.MediumNotConnected("a medium")
self.assertEqualDiff(
"The medium 'a medium' is not connected.", str(error))
-
+
+ def test_no_public_branch(self):
+ b = self.make_branch('.')
+ error = errors.NoPublicBranch(b)
+ url = urlutils.unescape_for_display(b.base, 'ascii')
+ self.assertEqualDiff(
+ 'There is no public branch set for "%s".' % url, str(error))
+
def test_no_repo(self):
dir = bzrdir.BzrDir.create(self.get_url())
error = errors.NoRepositoryPresent(dir)
More information about the bazaar-commits
mailing list