Rev 3784: Include staging in lp-login, remove username from lp: urls (abentley) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Oct 17 23:03:39 BST 2008


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

------------------------------------------------------------
revno: 3784
revision-id: pqm at pqm.ubuntu.com-20081017220336-a1m0npnjf9ojnfbj
parent: pqm at pqm.ubuntu.com-20081017125551-l5zi213vopny82nt
parent: aaron at aaronbentley.com-20081017142511-jr470g67voko39dd
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2008-10-17 23:03:36 +0100
message:
  Include staging in lp-login, remove username from lp: urls (abentley)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/plugins/launchpad/account.py account.py-20071011033320-50y6vfftywf4yllw-1
  bzrlib/plugins/launchpad/lp_directory.py lp_indirect.py-20070126012204-de5rugwlt22c7u7e-1
  bzrlib/plugins/launchpad/test_account.py test_account.py-20071011033320-50y6vfftywf4yllw-2
  bzrlib/plugins/launchpad/test_lp_directory.py test_lp_indirect.py-20070126002743-oyle362tzv9cd8mi-1
    ------------------------------------------------------------
    revno: 3777.1.22
    revision-id: aaron at aaronbentley.com-20081017142511-jr470g67voko39dd
    parent: aaron at aaronbentley.com-20081017142120-tuh84cyuh9z6emod
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: remove-url-username
    timestamp: Fri 2008-10-17 10:25:11 -0400
    message:
      Add name
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3777.1.21
    revision-id: aaron at aaronbentley.com-20081017142120-tuh84cyuh9z6emod
    parent: aaron at aaronbentley.com-20081017140437-po5jewwstmc1lo6w
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: remove-url-username
    timestamp: Fri 2008-10-17 10:21:20 -0400
    message:
      Stop including usernames in resolved lp: urls
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/plugins/launchpad/lp_directory.py lp_indirect.py-20070126012204-de5rugwlt22c7u7e-1
      bzrlib/plugins/launchpad/test_lp_directory.py test_lp_indirect.py-20070126002743-oyle362tzv9cd8mi-1
    ------------------------------------------------------------
    revno: 3777.1.20
    revision-id: aaron at aaronbentley.com-20081017140437-po5jewwstmc1lo6w
    parent: aaron at aaronbentley.com-20081017133742-7ysoh4gx7kxs29lh
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: update-staging
    timestamp: Fri 2008-10-17 10:04:37 -0400
    message:
      Include staging in launchpad-login authentication.
    modified:
      bzrlib/plugins/launchpad/account.py account.py-20071011033320-50y6vfftywf4yllw-1
      bzrlib/plugins/launchpad/test_account.py test_account.py-20071011033320-50y6vfftywf4yllw-2
    ------------------------------------------------------------
    revno: 3777.1.19
    revision-id: aaron at aaronbentley.com-20081017133742-7ysoh4gx7kxs29lh
    parent: aaron at aaronbentley.com-20081017122234-4lygct4bu1hsube6
    parent: pqm at pqm.ubuntu.com-20081017125551-l5zi213vopny82nt
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: update-staging
    timestamp: Fri 2008-10-17 09:37:42 -0400
    message:
      Merge with bzr.dev
    modified:
      bzrlib/patches.py              patches.py-20050727183609-378c1cc5972ce908
      bzrlib/tests/test_patches.py   test_patches.py-20051231203844-f4974d20f6aea09c
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
=== modified file 'NEWS'
--- a/NEWS	2008-10-16 18:48:10 +0000
+++ b/NEWS	2008-10-17 14:25:11 +0000
@@ -22,6 +22,9 @@
     * launchpad-login now provides a default username for bzr+ssh and sftp
       URLs, allowing username-free URLs to work for everyone. (Aaron Bentley)
 
+    * lp: lookups no longer include usernames, making them shareable and
+      shorter. (Aaron Bentley)
+
   BUG FIXES:
 
     * A failure to load a plugin due to an IncompatibleAPI exception is

=== modified file 'bzrlib/plugins/launchpad/account.py'
--- a/bzrlib/plugins/launchpad/account.py	2008-10-17 12:22:34 +0000
+++ b/bzrlib/plugins/launchpad/account.py	2008-10-17 14:04:37 +0000
@@ -54,13 +54,14 @@
     username = _config.get_user_option('launchpad_username')
     if username is not None:
         auth = AuthenticationConfig()
-        auth_username = _get_auth_user(auth)
+        auth_usernames = _get_auth_user(auth)
+        for auth_username in auth_usernames.values():
+            if auth_username is not None and auth_username != username:
+                raise MismatchedUsernames()
         # Auto-upgrading
-        if auth_username is None:
-            trace.note('Setting ssh/sftp username for bazaar.launchpad.net.')
+        if None in auth_usernames.values():
+            trace.note('Setting ssh/sftp usernames for launchpad.net.')
             _set_auth_user(username, auth)
-        elif auth_username != username:
-            raise MismatchedUsernames()
     return username
 
 
@@ -79,13 +80,16 @@
 def _get_auth_user(auth=None):
     if auth is None:
         auth = AuthenticationConfig()
-    return auth.get_user('ssh', 'bazaar.launchpad.net')
+    return {'production': auth.get_user('ssh', 'bazaar.launchpad.net'),
+            'staging': auth.get_user('ssh', 'bazaar.staging.launchpad.net'),}
 
 def _set_auth_user(username, auth=None):
     if auth is None:
         auth = AuthenticationConfig()
     auth.set_credentials(
         'Launchpad', 'bazaar.launchpad.net', username, 'ssh')
+    auth.set_credentials(
+        'Launchpad Staging', 'bazaar.staging.launchpad.net', username, 'ssh')
 
 
 def check_lp_login(username, _transport=None):

=== modified file 'bzrlib/plugins/launchpad/lp_directory.py'
--- a/bzrlib/plugins/launchpad/lp_directory.py	2008-04-18 22:07:16 +0000
+++ b/bzrlib/plugins/launchpad/lp_directory.py	2008-10-17 14:21:20 +0000
@@ -90,6 +90,8 @@
                                               fragment):
                 # Only accept launchpad.net bzr+ssh URLs if we know
                 # the user's Launchpad login:
+                if _lp_login is not None:
+                    break
                 if _lp_login is None:
                     if not _warned_login:
                         trace.warning('You have not informed bzr of your '
@@ -97,10 +99,6 @@
                                 'write operation and it fails, run '
                                 '"bzr launchpad-login YOUR_ID" and try again.')
                         _warned_login = True
-                    continue
-                url = urlunsplit((scheme, '%s@%s' % (_lp_login, netloc),
-                                  path, query, fragment))
-                break
             else:
                 # Use the URL if we can create a transport for it.
                 try:

=== modified file 'bzrlib/plugins/launchpad/test_account.py'
--- a/bzrlib/plugins/launchpad/test_account.py	2008-10-17 12:22:34 +0000
+++ b/bzrlib/plugins/launchpad/test_account.py	2008-10-17 14:04:37 +0000
@@ -64,23 +64,27 @@
                              'SSH keys with Launchpad.', str(error))
 
     def test_set_lp_login_updates_authentication_conf(self):
-        self.assertIs(None, account._get_auth_user())
+        self.assertEqual([None, None], account._get_auth_user().values())
         account.set_lp_login('foo')
-        self.assertEqual('foo', account._get_auth_user())
+        self.assertEqual({'production': 'foo', 'staging': 'foo'},
+                         account._get_auth_user())
 
     def test_get_lp_login_does_not_update_for_none_user(self):
         account.get_lp_login()
-        self.assertIs(None, account._get_auth_user())
+        self.assertEqual([None, None], account._get_auth_user().values())
 
     def test_get_lp_login_updates_authentication_conf(self):
         account._set_global_option('foo')
-        self.assertIs(None, account._get_auth_user())
+        self.assertEqual([None, None], account._get_auth_user().values())
         account.get_lp_login()
-        self.assertEqual('foo', account._get_auth_user())
+        self.assertEqual({'production': 'foo', 'staging': 'foo'},
+                         account._get_auth_user())
 
     def test_get_lp_login_leaves_existing_credentials(self):
         auth = config.AuthenticationConfig()
         auth.set_credentials('Foo', 'bazaar.launchpad.net', 'foo', 'ssh')
+        auth.set_credentials('Bar', 'bazaar.staging.launchpad.net', 'foo',
+                             'ssh')
         account._set_global_option('foo')
         account.get_lp_login()
         auth = config.AuthenticationConfig()

=== modified file 'bzrlib/plugins/launchpad/test_lp_directory.py'
--- a/bzrlib/plugins/launchpad/test_lp_directory.py	2008-10-17 12:22:34 +0000
+++ b/bzrlib/plugins/launchpad/test_lp_directory.py	2008-10-17 14:21:20 +0000
@@ -150,7 +150,7 @@
                     'http://bazaar.launchpad.net/~apt/apt/devel']))
         directory = LaunchpadDirectory()
         self.assertEquals(
-            'bzr+ssh://username@bazaar.launchpad.net/~apt/apt/devel',
+            'bzr+ssh://bazaar.launchpad.net/~apt/apt/devel',
             directory._resolve('lp:///apt', factory, _lp_login='username'))
 
     def test_no_rewrite_of_other_bzr_ssh(self):




More information about the bazaar-commits mailing list