~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/launchpad/account.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-17 18:13:57 UTC
  • mfrom: (5268.7.29 transport-segments)
  • Revision ID: pqm@pqm.ubuntu.com-20110817181357-y5q5eth1hk8bl3om
(jelmer) Allow specifying the colocated branch to use in the branch URL,
 and retrieving the branch name using ControlDir._get_selected_branch.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
than once for each place that needs to take it into account.
21
21
"""
22
22
 
23
 
from __future__ import absolute_import
24
 
 
25
23
from bzrlib import (
26
24
    errors,
27
25
    trace,
28
26
    transport,
29
27
    )
30
 
from bzrlib.config import AuthenticationConfig, GlobalStack
31
 
from bzrlib.i18n import gettext
 
28
from bzrlib.config import AuthenticationConfig, GlobalConfig
 
29
 
32
30
 
33
31
LAUNCHPAD_BASE = 'https://launchpad.net/'
34
32
 
55
53
        disagree about username.
56
54
    """
57
55
    if _config is None:
58
 
        _config = GlobalStack()
 
56
        _config = GlobalConfig()
59
57
 
60
 
    username = _config.get('launchpad_username')
 
58
    username = _config.get_user_option('launchpad_username')
61
59
    if username is not None:
62
60
        auth = AuthenticationConfig()
63
61
        auth_username = _get_auth_user(auth)
64
62
        # Auto-upgrading
65
63
        if auth_username is None:
66
 
            trace.note(gettext('Setting ssh/sftp usernames for launchpad.net.'))
 
64
            trace.note('Setting ssh/sftp usernames for launchpad.net.')
67
65
            _set_auth_user(username, auth)
68
66
        elif auth_username != username:
69
67
            raise MismatchedUsernames()
72
70
 
73
71
def _set_global_option(username, _config=None):
74
72
    if _config is None:
75
 
        _config = GlobalStack()
76
 
    _config.set('launchpad_username', username)
 
73
        _config = GlobalConfig()
 
74
    _config.set_user_option('launchpad_username', username)
77
75
 
78
76
 
79
77
def set_lp_login(username, _config=None):