/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/git/remote.py

  • Committer: Jelmer Vernooij
  • Date: 2020-07-05 12:50:01 UTC
  • mfrom: (7490.40.46 work)
  • mto: (7490.40.48 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200705125001-7s3vo0p55szbbws7
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Remote dirs, repositories and branches."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
import gzip
20
22
from io import BytesIO
21
23
import re
48
50
    )
49
51
from ..revision import NULL_REVISION
50
52
from ..revisiontree import RevisionTree
 
53
from ..sixish import (
 
54
    text_type,
 
55
    viewitems,
 
56
    )
51
57
from ..transport import (
52
58
    Transport,
53
59
    register_urlparse_netloc_protocol,
117
123
import os
118
124
import select
119
125
 
120
 
import urllib.parse as urlparse
121
 
from urllib.parse import splituser
 
126
try:
 
127
    import urllib.parse as urlparse
 
128
    from urllib.parse import splituser
 
129
except ImportError:
 
130
    import urlparse
 
131
    from urllib import splituser
122
132
 
123
133
# urlparse only supports a limited number of schemes by default
124
134
register_urlparse_netloc_protocol('git')
204
214
    if re.match('(.+) is not a valid repository name',
205
215
                message.splitlines()[0]):
206
216
        return NotBranchError(url, message)
207
 
    if message == (
208
 
            'GitLab: You are not allowed to push code to protected branches '
209
 
            'on this project.'):
210
 
        return PermissionDenied(url, message)
211
217
    m = re.match(r'Permission to ([^ ]+) denied to ([^ ]+)\.', message)
212
218
    if m:
213
219
        return PermissionDenied(m.group(1), 'denied to %s' % m.group(2))
629
635
                        source, self.open_branch(name, nascent_ok=True))
630
636
            ret[actual_refname] = new_sha
631
637
            if fetch_tags:
632
 
                for tagname, revid in source.tags.get_tag_dict().items():
 
638
                for tagname, revid in viewitems(source.tags.get_tag_dict()):
633
639
                    if tag_selector and not tag_selector(tagname):
634
640
                        continue
635
641
                    if lossy:
1074
1080
            if peeled is None:
1075
1081
                # Let's just hope it's a commit
1076
1082
                peeled = unpeeled
1077
 
            if not isinstance(tag_name, str):
 
1083
            if not isinstance(tag_name, text_type):
1078
1084
                raise TypeError(tag_name)
1079
1085
            yield (ref_name, tag_name, peeled, unpeeled)
1080
1086