##// 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 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 275 def is_http_path(url):
@@ -457,12 +457,13 b' class HTTPPasswordHandler(object):'
457 457 from mercurial.httpconnection import readauthforuri
458 458 ui.debug(meu.ui_string("keyring: checking for hgrc info about url %s, user %s\n",
459 459 parsed_url, user))
460 res = readauthforuri(ui, str(parsed_url), user)
460
461 res = readauthforuri(ui, bytes(parsed_url), user)
461 462 # If it user-less version not work, let's try with added username to handle
462 463 # both config conventions
463 464 if (not res) and user:
464 465 parsed_url.user = user
465 res = readauthforuri(ui, str(parsed_url), user)
466 res = readauthforuri(ui, bytes(parsed_url), user)
466 467 parsed_url.user = None
467 468 if res:
468 469 group, auth_token = res
@@ -470,15 +471,15 b' class HTTPPasswordHandler(object):'
470 471 auth_token = None
471 472
472 473 if auth_token:
473 username = auth_token.get('username')
474 password = auth_token.get('password')
475 prefix = auth_token.get('prefix')
474 username = auth_token.get(b'username')
475 password = auth_token.get(b'password')
476 prefix = auth_token.get(b'prefix')
476 477 else:
477 478 username = user
478 479 password = None
479 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 484 ui.debug(meu.ui_string("keyring: Password url: %s, user: %s, password: %s (prefix: %s)\n",
484 485 password_url, username,
@@ -519,15 +520,15 b' class HTTPPasswordHandler(object):'
519 520 """Calculates actual url identifying the password. Takes
520 521 configured prefix under consideration (so can be shorter
521 522 than repo url)"""
522 if not prefix or prefix == '*':
523 if not prefix or prefix == b'*':
523 524 return base_url
524 scheme, hostpath = base_url.split('://', 1)
525 p = prefix.split('://', 1)
525 scheme, hostpath = base_url.split(b'://', 1)
526 p = prefix.split(b'://', 1)
526 527 if len(p) > 1:
527 528 prefix_host_path = p[1]
528 529 else:
529 530 prefix_host_path = prefix
530 password_url = scheme + '://' + prefix_host_path
531 password_url = scheme + b'://' + prefix_host_path
531 532 return password_url
532 533
533 534 @staticmethod
@@ -787,7 +788,7 b' def cmd_keyring_check(ui, repo, *path_ar'
787 788 are HTTP-like.
788 789 """
789 790 defined_paths = [(name, url)
790 for name, url in ui.configitems('paths')]
791 for name, url in ui.configitems(b'paths')]
791 792 if path_args:
792 793 # Maybe parameter is an alias
793 794 defined_paths_dic = dict(defined_paths)
General Comments 0
You need to be logged in to leave comments. Login now