Rev 5617: (jelmer) Add support for qastaging in the launchpad plugin. (Jelmer Vernooij) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jan 19 00:22:54 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5617 [merge]
revision-id: pqm at pqm.ubuntu.com-20110119002251-jvcp6iax3440b8it
parent: pqm at pqm.ubuntu.com-20110117021036-1wijz0xbaiw6cb8d
parent: jelmer at samba.org-20110118183104-86y6ghw7djs6a305
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-01-19 00:22:51 +0000
message:
  (jelmer) Add support for qastaging in the launchpad plugin. (Jelmer Vernooij)
modified:
  bzrlib/plugins/launchpad/lp_api.py lp_api.py-20090704082908-79il6zl4gugwl3wz-1
  bzrlib/plugins/launchpad/lp_registration.py lp_registration.py-20060315190948-daa617eafe3a8d48
  bzrlib/plugins/launchpad/test_lp_api.py test_lp_api.py-20091217012733-8sgahbhjn35ilrbu-1
  bzrlib/plugins/launchpad/test_lp_directory.py test_lp_indirect.py-20070126002743-oyle362tzv9cd8mi-1
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/plugins/launchpad/lp_api.py'
--- a/bzrlib/plugins/launchpad/lp_api.py	2010-12-02 10:41:05 +0000
+++ b/bzrlib/plugins/launchpad/lp_api.py	2011-01-18 18:31:04 +0000
@@ -47,11 +47,12 @@
     STAGING_SERVICE_ROOT,
     Launchpad,
     )
-try:
-    from launchpadlib.uris import LPNET_SERVICE_ROOT
-except ImportError:
-    LPNET_SERVICE_ROOT = 'https://api.launchpad.net/beta/'
+from launchpadlib import uris
 
+LPNET_SERVICE_ROOT = getattr(uris, 'LPNET_SERVICE_ROOT',
+                             'https://api.launchpad.net/beta/')
+QASTAGING_SERVICE_ROOT = getattr(uris, 'QASTAGING_SERVICE_ROOT',
+                                 'https://api.qastaging.launchpad.net/')
 
 # Declare the minimum version of launchpadlib that we need in order to work.
 # 1.5.1 is the version of launchpadlib packaged in Ubuntu 9.10, the most
@@ -80,6 +81,7 @@
 
 LAUNCHPAD_API_URLS = {
     'production': LPNET_SERVICE_ROOT,
+    'qastaging': QASTAGING_SERVICE_ROOT,
     'staging': STAGING_SERVICE_ROOT,
     'dev': 'https://api.launchpad.dev/beta/',
     }
@@ -189,12 +191,13 @@
     @staticmethod
     def tweak_url(url, launchpad):
         """Adjust a URL to work with staging, if needed."""
-        if str(launchpad._root_uri) != STAGING_SERVICE_ROOT:
-            return url
-        if url is None:
-            return None
-        return url.replace('bazaar.launchpad.net',
-                           'bazaar.staging.launchpad.net')
+        if str(launchpad._root_uri) == STAGING_SERVICE_ROOT:
+            return url.replace('bazaar.launchpad.net',
+                               'bazaar.staging.launchpad.net')
+        elif str(launchpad._root_uri) == QASTAGING_SERVICE_ROOT:
+            return url.replace('bazaar.launchpad.net',
+                               'bazaar.qastaging.launchpad.net')
+        return url
 
     @classmethod
     def from_bzr(cls, launchpad, bzr_branch, create_missing=True):

=== modified file 'bzrlib/plugins/launchpad/lp_registration.py'
--- a/bzrlib/plugins/launchpad/lp_registration.py	2010-12-02 09:23:10 +0000
+++ b/bzrlib/plugins/launchpad/lp_registration.py	2011-01-17 06:26:35 +0000
@@ -86,6 +86,7 @@
 
     LAUNCHPAD_DOMAINS = {
         'production': 'launchpad.net',
+        'qastaging': 'qastaging.launchpad.net',
         'staging': 'staging.launchpad.net',
         'demo': 'demo.launchpad.net',
         'dev': 'launchpad.dev',

=== modified file 'bzrlib/plugins/launchpad/test_lp_api.py'
--- a/bzrlib/plugins/launchpad/test_lp_api.py	2010-03-05 08:55:12 +0000
+++ b/bzrlib/plugins/launchpad/test_lp_api.py	2011-01-17 06:26:35 +0000
@@ -15,8 +15,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 
-from bzrlib import commands, config, errors, osutils
-from bzrlib.plugins.launchpad import cmd_launchpad_mirror
+from bzrlib import config, errors, osutils
 from bzrlib.tests import (
     ModuleAvailableFeature,
     TestCase,

=== modified file 'bzrlib/plugins/launchpad/test_lp_directory.py'
--- a/bzrlib/plugins/launchpad/test_lp_directory.py	2011-01-10 22:20:12 +0000
+++ b/bzrlib/plugins/launchpad/test_lp_directory.py	2011-01-17 06:26:35 +0000
@@ -91,6 +91,19 @@
         self.assertEquals('https://xmlrpc.launchpad.net/bazaar/',
                           factory._service_url)
 
+    def test_qastaging(self):
+        """A launchpad url should map to a http url"""
+        factory = FakeResolveFactory(
+            self, 'apt', dict(urls=[
+                    'http://bazaar.qastaging.launchpad.net/~apt/apt/devel']))
+        url = 'lp://qastaging/apt'
+        directory = LaunchpadDirectory()
+        self.assertEquals('http://bazaar.qastaging.launchpad.net/~apt/apt/devel',
+                          directory._resolve(url, factory))
+        # Make sure that resolve went to the qastaging server.
+        self.assertEquals('https://xmlrpc.qastaging.launchpad.net/bazaar/',
+                          factory._service_url)
+
     def test_staging(self):
         """A launchpad url should map to a http url"""
         factory = FakeResolveFactory(

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-01-15 07:05:45 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-01-17 23:22:24 +0000
@@ -20,6 +20,9 @@
 
 .. New commands, options, etc that users may wish to try out.
 
+* The ``lp:`` directory service now supports Launchpad's QA staging.
+  (Jelmer Vernooij, #667483)
+
 Improvements
 ************
 




More information about the bazaar-commits mailing list