/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/propose/gitlabs.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-02-14 03:01:45 UTC
  • mfrom: (7268.3.1 gitlab-auth-fix)
  • Revision ID: breezy.the.bot@gmail.com-20190214030145-smog41ldllurhs9j
Drop support for getting gitlab authentication from authentication.conf.

Merged from https://code.launchpad.net/~jelmer/brz/gitlab-auth-fix/+merge/363101

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    errors,
25
25
    urlutils,
26
26
    )
27
 
from ...config import AuthenticationConfig
28
27
from ...git.urls import git_url_to_bzr_url
29
28
from ...sixish import PY3
30
29
 
100
99
 
101
100
def connect_gitlab(host):
102
101
    from gitlab import Gitlab, GitlabGetError
103
 
    auth = AuthenticationConfig()
104
 
 
105
102
    url = 'https://%s' % host
106
 
    credentials = auth.get_credentials('https', host)
107
 
    if credentials is None:
108
 
        for name, section in iter_tokens():
109
 
            if section.get('url') == url:
110
 
                credentials = section
111
 
                break
112
 
        else:
113
 
            try:
114
 
                return Gitlab(url)
115
 
            except GitlabGetError:
116
 
                raise GitLabLoginMissing()
 
103
    for name, section in iter_tokens():
 
104
        if section.get('url') == url:
 
105
            return Gitlab(**section)
117
106
    else:
118
 
        credentials['url'] = url
119
 
    return Gitlab(**credentials)
 
107
        try:
 
108
            return Gitlab(url)
 
109
        except GitlabGetError:
 
110
            raise GitLabLoginMissing()
120
111
 
121
112
 
122
113
def parse_gitlab_url(branch):