Merge lp:~jelmer/bzr/lp-qa-staging into lp:bzr

Proposed by Jelmer Vernooij
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 5617
Proposed branch: lp:~jelmer/bzr/lp-qa-staging
Merge into: lp:bzr
Diff against target: 111 lines (+31/-12)
5 files modified
bzrlib/plugins/launchpad/lp_api.py (+13/-10)
bzrlib/plugins/launchpad/lp_registration.py (+1/-0)
bzrlib/plugins/launchpad/test_lp_api.py (+1/-2)
bzrlib/plugins/launchpad/test_lp_directory.py (+13/-0)
doc/en/release-notes/bzr-2.4.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/bzr/lp-qa-staging
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+46515@code.launchpad.net

Commit message

Add support for qastaging in the launchpad plugin.

Description of the change

This adds support for lp://qastaging

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 1/17/2011 12:45 PM, Jelmer Vernooij wrote:
> Jelmer Vernooij has proposed merging lp:~jelmer/bzr/lp-qa-staging into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
>
> For more details, see:
> https://code.launchpad.net/~jelmer/bzr/lp-qa-staging/+merge/46515
>
> This adds support for lp://qastaging

     from launchpadlib.uris import LPNET_SERVICE_ROOT
 except ImportError:
     LPNET_SERVICE_ROOT = 'https://api.launchpad.net/beta/'
+try:
+ from launchpadlib.uris import QASTAGING_SERVICE_ROOT
+except ImportError:
+ QASTAGING_SERVICE_ROOT = 'https://api.qastaging.launchpad.net/'

^- These sure look like things that should be done with getattr() rather
than import hacks. Can we change these to:

from launchpadlib import uris

QASTAGING_SERVICE_ROOT = getattr(uris, 'QASTAGING_SERVICE_ROOT',
     'https://api.qastaging.launchpad.net')

etc.

launchpadlib may be doing import time hacks, but I doubt it.

The rest looks good to me. I would make sure you manually tested it, but
otherwise I'm happy.

 merge: approve

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk011pAACgkQJdeBCYSNAANGrACfc/oUxjzdgBvnVnKj8Cs8VnIf
ZuoAoIIxa+r1h36raJcEdpaKaxUIjz87
=thDm
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/plugins/launchpad/lp_api.py'
2--- bzrlib/plugins/launchpad/lp_api.py 2010-12-02 10:41:05 +0000
3+++ bzrlib/plugins/launchpad/lp_api.py 2011-01-18 18:53:28 +0000
4@@ -47,11 +47,12 @@
5 STAGING_SERVICE_ROOT,
6 Launchpad,
7 )
8-try:
9- from launchpadlib.uris import LPNET_SERVICE_ROOT
10-except ImportError:
11- LPNET_SERVICE_ROOT = 'https://api.launchpad.net/beta/'
12+from launchpadlib import uris
13
14+LPNET_SERVICE_ROOT = getattr(uris, 'LPNET_SERVICE_ROOT',
15+ 'https://api.launchpad.net/beta/')
16+QASTAGING_SERVICE_ROOT = getattr(uris, 'QASTAGING_SERVICE_ROOT',
17+ 'https://api.qastaging.launchpad.net/')
18
19 # Declare the minimum version of launchpadlib that we need in order to work.
20 # 1.5.1 is the version of launchpadlib packaged in Ubuntu 9.10, the most
21@@ -80,6 +81,7 @@
22
23 LAUNCHPAD_API_URLS = {
24 'production': LPNET_SERVICE_ROOT,
25+ 'qastaging': QASTAGING_SERVICE_ROOT,
26 'staging': STAGING_SERVICE_ROOT,
27 'dev': 'https://api.launchpad.dev/beta/',
28 }
29@@ -189,12 +191,13 @@
30 @staticmethod
31 def tweak_url(url, launchpad):
32 """Adjust a URL to work with staging, if needed."""
33- if str(launchpad._root_uri) != STAGING_SERVICE_ROOT:
34- return url
35- if url is None:
36- return None
37- return url.replace('bazaar.launchpad.net',
38- 'bazaar.staging.launchpad.net')
39+ if str(launchpad._root_uri) == STAGING_SERVICE_ROOT:
40+ return url.replace('bazaar.launchpad.net',
41+ 'bazaar.staging.launchpad.net')
42+ elif str(launchpad._root_uri) == QASTAGING_SERVICE_ROOT:
43+ return url.replace('bazaar.launchpad.net',
44+ 'bazaar.qastaging.launchpad.net')
45+ return url
46
47 @classmethod
48 def from_bzr(cls, launchpad, bzr_branch, create_missing=True):
49
50=== modified file 'bzrlib/plugins/launchpad/lp_registration.py'
51--- bzrlib/plugins/launchpad/lp_registration.py 2010-12-02 09:23:10 +0000
52+++ bzrlib/plugins/launchpad/lp_registration.py 2011-01-18 18:53:28 +0000
53@@ -86,6 +86,7 @@
54
55 LAUNCHPAD_DOMAINS = {
56 'production': 'launchpad.net',
57+ 'qastaging': 'qastaging.launchpad.net',
58 'staging': 'staging.launchpad.net',
59 'demo': 'demo.launchpad.net',
60 'dev': 'launchpad.dev',
61
62=== modified file 'bzrlib/plugins/launchpad/test_lp_api.py'
63--- bzrlib/plugins/launchpad/test_lp_api.py 2010-03-05 08:55:12 +0000
64+++ bzrlib/plugins/launchpad/test_lp_api.py 2011-01-18 18:53:28 +0000
65@@ -15,8 +15,7 @@
66 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
67
68
69-from bzrlib import commands, config, errors, osutils
70-from bzrlib.plugins.launchpad import cmd_launchpad_mirror
71+from bzrlib import config, errors, osutils
72 from bzrlib.tests import (
73 ModuleAvailableFeature,
74 TestCase,
75
76=== modified file 'bzrlib/plugins/launchpad/test_lp_directory.py'
77--- bzrlib/plugins/launchpad/test_lp_directory.py 2011-01-10 22:20:12 +0000
78+++ bzrlib/plugins/launchpad/test_lp_directory.py 2011-01-18 18:53:28 +0000
79@@ -91,6 +91,19 @@
80 self.assertEquals('https://xmlrpc.launchpad.net/bazaar/',
81 factory._service_url)
82
83+ def test_qastaging(self):
84+ """A launchpad url should map to a http url"""
85+ factory = FakeResolveFactory(
86+ self, 'apt', dict(urls=[
87+ 'http://bazaar.qastaging.launchpad.net/~apt/apt/devel']))
88+ url = 'lp://qastaging/apt'
89+ directory = LaunchpadDirectory()
90+ self.assertEquals('http://bazaar.qastaging.launchpad.net/~apt/apt/devel',
91+ directory._resolve(url, factory))
92+ # Make sure that resolve went to the qastaging server.
93+ self.assertEquals('https://xmlrpc.qastaging.launchpad.net/bazaar/',
94+ factory._service_url)
95+
96 def test_staging(self):
97 """A launchpad url should map to a http url"""
98 factory = FakeResolveFactory(
99
100=== modified file 'doc/en/release-notes/bzr-2.4.txt'
101--- doc/en/release-notes/bzr-2.4.txt 2011-01-15 07:05:45 +0000
102+++ doc/en/release-notes/bzr-2.4.txt 2011-01-18 18:53:28 +0000
103@@ -20,6 +20,9 @@
104
105 .. New commands, options, etc that users may wish to try out.
106
107+* The ``lp:`` directory service now supports Launchpad's QA staging.
108+ (Jelmer Vernooij, #667483)
109+
110 Improvements
111 ************
112