Rev 3794: Use wildcard matching for launchpad usernames (abentley) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Oct 24 12:38:32 BST 2008


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

------------------------------------------------------------
revno: 3794
revision-id: pqm at pqm.ubuntu.com-20081024113829-9geq0uavium22ho6
parent: pqm at pqm.ubuntu.com-20081023190411-v80cdeda5cq1sog1
parent: aaron at aaronbentley.com-20081023174337-1vuwf85rpbuclztf
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2008-10-24 12:38:29 +0100
message:
  Use wildcard matching for launchpad usernames (abentley)
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.24
    revision-id: aaron at aaronbentley.com-20081023174337-1vuwf85rpbuclztf
    parent: aaron at aaronbentley.com-20081023172724-9fgre62mtqqz2tta
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: remove-url-username
    timestamp: Thu 2008-10-23 18:43:37 +0100
    message:
      Use .launchpad.net instead of bazaar. and bazaar.staging.
    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.23
    revision-id: aaron at aaronbentley.com-20081023172724-9fgre62mtqqz2tta
    parent: aaron at aaronbentley.com-20081017142511-jr470g67voko39dd
    parent: pqm at pqm.ubuntu.com-20081021231845-k119hl1icewguq50
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: remove-url-username
    timestamp: Thu 2008-10-23 18:27:24 +0100
    message:
      Merge with bzr.dev
    added:
      bzrlib/tests/fake_command.py   fake_command.py-20081021195002-r9v65tgxx63c25v9-1
      doc/developers/cycle.txt       cycle.txt-20081017031739-rw24r0cywm2ok3xu-1
      tools/packaging/lp-upload-release lpuploadrelease-20081020075647-56zdf9z6yav1bx81-1
    modified:
      Makefile                       Makefile-20050805140406-d96e3498bb61c5bb
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/tests/blackbox/test_command_encoding.py test_command_encoding.py-20060106032110-45431fd2ce9ff21f
      bzrlib/tests/test_commands.py  test_command.py-20051019190109-3b17be0f52eaa7a8
      bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
      bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
      bzrlib/tests/test_store.py     teststore.py-20050826022702-f6caadb647395769
      doc/developers/index.txt       index.txt-20070508041241-qznziunkg0nffhiw-1
      doc/developers/releasing.txt   releasing.txt-20080502015919-fnrcav8fwy8ccibu-1
=== modified file 'bzrlib/plugins/launchpad/account.py'
--- a/bzrlib/plugins/launchpad/account.py	2008-10-17 14:04:37 +0000
+++ b/bzrlib/plugins/launchpad/account.py	2008-10-23 17:43:37 +0000
@@ -54,14 +54,13 @@
     username = _config.get_user_option('launchpad_username')
     if username is not None:
         auth = AuthenticationConfig()
-        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()
+        auth_username = _get_auth_user(auth)
         # Auto-upgrading
-        if None in auth_usernames.values():
+        if auth_username is None:
             trace.note('Setting ssh/sftp usernames for launchpad.net.')
             _set_auth_user(username, auth)
+        elif auth_username != username:
+            raise MismatchedUsernames()
     return username
 
 
@@ -80,16 +79,13 @@
 def _get_auth_user(auth=None):
     if auth is None:
         auth = AuthenticationConfig()
-    return {'production': auth.get_user('ssh', 'bazaar.launchpad.net'),
-            'staging': auth.get_user('ssh', 'bazaar.staging.launchpad.net'),}
+    return auth.get_user('ssh', '.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')
+        'Launchpad', '.launchpad.net', username, 'ssh')
 
 
 def check_lp_login(username, _transport=None):

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




More information about the bazaar-commits mailing list