Show More
@@ -317,7 +317,8 b' class HTTPPasswordHandler(object):' | |||
|
317 | 317 | """ |
|
318 | 318 | ui = pwmgr.ui |
|
319 | 319 | |
|
320 |
|
|
|
320 | parsed_url, url_user, url_passwd = self.unpack_url(authuri) | |
|
321 | base_url = str(parsed_url) | |
|
321 | 322 | ui.debug(_('keyring: base url: %s, url user: %s, url pwd: %s\n') % |
|
322 | 323 | (base_url, url_user or '', url_passwd and '******' or '')) |
|
323 | 324 | |
@@ -335,7 +336,7 b' class HTTPPasswordHandler(object):' | |||
|
335 | 336 | # Consult configuration to normalize url to prefix, and find username |
|
336 | 337 | # (and maybe password) |
|
337 | 338 | auth_user, auth_pwd, keyring_url = self.get_url_config( |
|
338 |
ui, |
|
|
339 | ui, parsed_url, url_user) | |
|
339 | 340 | if auth_user and url_user and (url_user != auth_user): |
|
340 | 341 | raise util.Abort(_('keyring: username for %s specified both in repository path (%s) and in .hg/hgrc/[auth] (%s). Please, leave only one of those' % (base_url, url_user, auth_user))) |
|
341 | 342 | if auth_user and auth_pwd: |
@@ -415,7 +416,7 b' class HTTPPasswordHandler(object):' | |||
|
415 | 416 | _debug(ui, _("Manually entered password")) |
|
416 | 417 | return user, pwd |
|
417 | 418 | |
|
418 |
def get_url_config(self, ui, |
|
|
419 | def get_url_config(self, ui, parsed_url, user): | |
|
419 | 420 | """ |
|
420 | 421 | Checks configuration to decide whether/which username, prefix, |
|
421 | 422 | and password are configured for given url. Consults [auth] section. |
@@ -424,9 +425,17 b' class HTTPPasswordHandler(object):' | |||
|
424 | 425 | found. username and password can be None (if unset), if prefix |
|
425 | 426 | is not found, url itself is returned. |
|
426 | 427 | """ |
|
428 | base_url = str(parsed_url) | |
|
429 | ||
|
427 | 430 | from mercurial.httpconnection import readauthforuri |
|
428 | 431 | _debug(ui, _("Checking for hgrc info about url %s, user %s") % (base_url, user)) |
|
429 | 432 | res = readauthforuri(ui, base_url, user) |
|
433 | # If it user-less version not work, let's try with added username to handle | |
|
434 | # both config conventions | |
|
435 | if (not res) and user: | |
|
436 | parsed_url.user = user | |
|
437 | res = readauthforuri(ui, str(parsed_url), user) | |
|
438 | parsed_url.user = None | |
|
430 | 439 | if res: |
|
431 | 440 | group, auth_token = res |
|
432 | 441 | else: |
@@ -503,6 +512,8 b' class HTTPPasswordHandler(object):' | |||
|
503 | 512 | (so prefix matching works properly) |
|
504 | 513 | |
|
505 | 514 | Returns url, user, password |
|
515 | where url is mercurial.util.url object already stripped of all those | |
|
516 | params. | |
|
506 | 517 | """ |
|
507 | 518 | # mercurial.util.url, rather handy url parser |
|
508 | 519 | parsed_url = util.url(authuri) |
@@ -516,7 +527,7 b' class HTTPPasswordHandler(object):' | |||
|
516 | 527 | parsed_url.user = None |
|
517 | 528 | parsed_url.passwd = None |
|
518 | 529 | |
|
519 |
return |
|
|
530 | return parsed_url, user, passwd | |
|
520 | 531 | |
|
521 | 532 | |
|
522 | 533 | ############################################################ |
General Comments 0
You need to be logged in to leave comments.
Login now