Show More
@@ -19,7 +19,12 b' import urllib.parse' | |||
|
19 | 19 | import urllib.request |
|
20 | 20 | from collections import OrderedDict |
|
21 | 21 | |
|
22 | import mercurial.util # import url as hg_url | |
|
22 | ||
|
23 | try: | |
|
24 | from mercurial.utils.urlutil import url as hg_url | |
|
25 | except ImportError: # urlutil was introduced in Mercurial 5.8 | |
|
26 | from mercurial.util import url as hg_url | |
|
27 | ||
|
23 | 28 | from dulwich.client import SubprocessGitClient |
|
24 | 29 | from dulwich.config import ConfigFile |
|
25 | 30 | from dulwich.objects import Tag |
@@ -226,7 +231,7 b' class GitRepository(BaseRepository):' | |||
|
226 | 231 | if parsed_url.scheme not in ['http', 'https']: |
|
227 | 232 | raise urllib.error.URLError("Unsupported protocol in URL %r" % url) |
|
228 | 233 | |
|
229 |
url_obj = |
|
|
234 | url_obj = hg_url(safe_bytes(url)) | |
|
230 | 235 | test_uri, handlers = get_urllib_request_handlers(url_obj) |
|
231 | 236 | if not test_uri.endswith(b'info/refs'): |
|
232 | 237 | test_uri = test_uri.rstrip(b'/') + b'/info/refs' |
@@ -34,7 +34,12 b' import mercurial.sshpeer' | |||
|
34 | 34 | import mercurial.tags |
|
35 | 35 | import mercurial.ui |
|
36 | 36 | import mercurial.unionrepo |
|
37 | import mercurial.util | |
|
37 | ||
|
38 | ||
|
39 | try: | |
|
40 | from mercurial.utils.urlutil import url as hg_url | |
|
41 | except ImportError: # urlutil was introduced in Mercurial 5.8 | |
|
42 | from mercurial.util import url as hg_url | |
|
38 | 43 | |
|
39 | 44 | from kallithea.lib.vcs.backends.base import BaseRepository, CollectionGenerator |
|
40 | 45 | from kallithea.lib.vcs.exceptions import (BranchDoesNotExistError, ChangesetDoesNotExistError, EmptyRepositoryError, RepositoryError, TagAlreadyExistError, |
@@ -336,7 +341,7 b' class MercurialRepository(BaseRepository' | |||
|
336 | 341 | if '+' in parsed_url.scheme: # strip 'git+' for hg-git URLs |
|
337 | 342 | url = url.split(b'+', 1)[1] |
|
338 | 343 | |
|
339 |
url_obj = |
|
|
344 | url_obj = hg_url(url) | |
|
340 | 345 | test_uri, handlers = get_urllib_request_handlers(url_obj) |
|
341 | 346 | |
|
342 | 347 | url_obj.passwd = b'*****' |
@@ -245,7 +245,7 b' def get_urllib_request_handlers(url_obj)' | |||
|
245 | 245 | if authinfo: |
|
246 | 246 | # authinfo is a tuple (realm, uris, user, password) where 'uris' itself |
|
247 | 247 | # is a tuple of URIs. |
|
248 |
# If url_obj is obtained via mercurial |
|
|
248 | # If url_obj is obtained via mercurial urlutil, the obtained authinfo | |
|
249 | 249 | # values will be bytes, e.g. |
|
250 | 250 | # (None, (b'http://127.0.0.1/repo', b'127.0.0.1'), b'user', b'pass') |
|
251 | 251 | # However, urllib expects strings, not bytes, so we must convert them. |
General Comments 0
You need to be logged in to leave comments.
Login now