equal
deleted
inserted
replaced
344 if not serverhostname: |
344 if not serverhostname: |
345 raise error.Abort(_('serverhostname argument is required')) |
345 raise error.Abort(_('serverhostname argument is required')) |
346 |
346 |
347 for f in (keyfile, certfile): |
347 for f in (keyfile, certfile): |
348 if f and not os.path.exists(f): |
348 if f and not os.path.exists(f): |
349 raise error.Abort(_('certificate file (%s) does not exist; ' |
349 raise error.Abort( |
350 'cannot connect to %s') % (f, serverhostname), |
350 _('certificate file (%s) does not exist; cannot connect to %s') |
351 hint=_('restore missing file or fix references ' |
351 % (f, pycompat.bytesurl(serverhostname)), |
352 'in Mercurial config')) |
352 hint=_('restore missing file or fix references ' |
|
353 'in Mercurial config')) |
353 |
354 |
354 settings = _hostsettings(ui, serverhostname) |
355 settings = _hostsettings(ui, serverhostname) |
355 |
356 |
356 # We can't use ssl.create_default_context() because it calls |
357 # We can't use ssl.create_default_context() because it calls |
357 # load_default_certs() unless CA arguments are passed to it. We want to |
358 # load_default_certs() unless CA arguments are passed to it. We want to |
370 |
371 |
371 if settings['ciphers']: |
372 if settings['ciphers']: |
372 try: |
373 try: |
373 sslcontext.set_ciphers(pycompat.sysstr(settings['ciphers'])) |
374 sslcontext.set_ciphers(pycompat.sysstr(settings['ciphers'])) |
374 except ssl.SSLError as e: |
375 except ssl.SSLError as e: |
375 raise error.Abort(_('could not set ciphers: %s') % e.args[0], |
376 raise error.Abort( |
376 hint=_('change cipher string (%s) in config') % |
377 _('could not set ciphers: %s') % util.forcebytestr(e.args[0]), |
377 settings['ciphers']) |
378 hint=_('change cipher string (%s) in config') % |
|
379 settings['ciphers']) |
378 |
380 |
379 if certfile is not None: |
381 if certfile is not None: |
380 def password(): |
382 def password(): |
381 f = keyfile or certfile |
383 f = keyfile or certfile |
382 return ui.getpass(_('passphrase for %s: ') % f, '') |
384 return ui.getpass(_('passphrase for %s: ') % f, '') |