##// END OF EJS Templates
some subtle py3-related fixes (bytes vs str in config-related actions)
Marcin Kasperski -
r275:cc32dad5 default
parent child Browse files
Show More
@@ -269,7 +269,7 b' class PwdCache(object):'
269 return self._cache.get(cache_key)
269 return self._cache.get(cache_key)
270
270
271
271
272 _re_http_url = re.compile(r'^https?://')
272 _re_http_url = re.compile(b'^https?://')
273
273
274
274
275 def is_http_path(url):
275 def is_http_path(url):
@@ -457,12 +457,13 b' class HTTPPasswordHandler(object):'
457 from mercurial.httpconnection import readauthforuri
457 from mercurial.httpconnection import readauthforuri
458 ui.debug(meu.ui_string("keyring: checking for hgrc info about url %s, user %s\n",
458 ui.debug(meu.ui_string("keyring: checking for hgrc info about url %s, user %s\n",
459 parsed_url, user))
459 parsed_url, user))
460 res = readauthforuri(ui, str(parsed_url), user)
460
461 res = readauthforuri(ui, bytes(parsed_url), user)
461 # If it user-less version not work, let's try with added username to handle
462 # If it user-less version not work, let's try with added username to handle
462 # both config conventions
463 # both config conventions
463 if (not res) and user:
464 if (not res) and user:
464 parsed_url.user = user
465 parsed_url.user = user
465 res = readauthforuri(ui, str(parsed_url), user)
466 res = readauthforuri(ui, bytes(parsed_url), user)
466 parsed_url.user = None
467 parsed_url.user = None
467 if res:
468 if res:
468 group, auth_token = res
469 group, auth_token = res
@@ -470,15 +471,15 b' class HTTPPasswordHandler(object):'
470 auth_token = None
471 auth_token = None
471
472
472 if auth_token:
473 if auth_token:
473 username = auth_token.get('username')
474 username = auth_token.get(b'username')
474 password = auth_token.get('password')
475 password = auth_token.get(b'password')
475 prefix = auth_token.get('prefix')
476 prefix = auth_token.get(b'prefix')
476 else:
477 else:
477 username = user
478 username = user
478 password = None
479 password = None
479 prefix = None
480 prefix = None
480
481
481 password_url = self.password_url(str(parsed_url), prefix)
482 password_url = self.password_url(bytes(parsed_url), prefix)
482
483
483 ui.debug(meu.ui_string("keyring: Password url: %s, user: %s, password: %s (prefix: %s)\n",
484 ui.debug(meu.ui_string("keyring: Password url: %s, user: %s, password: %s (prefix: %s)\n",
484 password_url, username,
485 password_url, username,
@@ -519,15 +520,15 b' class HTTPPasswordHandler(object):'
519 """Calculates actual url identifying the password. Takes
520 """Calculates actual url identifying the password. Takes
520 configured prefix under consideration (so can be shorter
521 configured prefix under consideration (so can be shorter
521 than repo url)"""
522 than repo url)"""
522 if not prefix or prefix == '*':
523 if not prefix or prefix == b'*':
523 return base_url
524 return base_url
524 scheme, hostpath = base_url.split('://', 1)
525 scheme, hostpath = base_url.split(b'://', 1)
525 p = prefix.split('://', 1)
526 p = prefix.split(b'://', 1)
526 if len(p) > 1:
527 if len(p) > 1:
527 prefix_host_path = p[1]
528 prefix_host_path = p[1]
528 else:
529 else:
529 prefix_host_path = prefix
530 prefix_host_path = prefix
530 password_url = scheme + '://' + prefix_host_path
531 password_url = scheme + b'://' + prefix_host_path
531 return password_url
532 return password_url
532
533
533 @staticmethod
534 @staticmethod
@@ -787,7 +788,7 b' def cmd_keyring_check(ui, repo, *path_ar'
787 are HTTP-like.
788 are HTTP-like.
788 """
789 """
789 defined_paths = [(name, url)
790 defined_paths = [(name, url)
790 for name, url in ui.configitems('paths')]
791 for name, url in ui.configitems(b'paths')]
791 if path_args:
792 if path_args:
792 # Maybe parameter is an alias
793 # Maybe parameter is an alias
793 defined_paths_dic = dict(defined_paths)
794 defined_paths_dic = dict(defined_paths)
General Comments 0
You need to be logged in to leave comments. Login now