comparison mercurial/httppeer.py @ 36220:874209855f5c

httppeer: remove httpspeer All it did was verify at construction time that Mercurial supports TLS. instance() is what's used to construct peer instances. So we can just inline this check into that function and do away with the type variant. Differential Revision: https://phab.mercurial-scm.org/D2216
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 12 Feb 2018 17:14:29 -0800
parents a463f375f021
children 2d513ab7ce94
comparison
equal deleted inserted replaced
36219:a463f375f021 36220:874209855f5c
478 return self._callstream(cmd, _compressible=True, **args) 478 return self._callstream(cmd, _compressible=True, **args)
479 479
480 def _abort(self, exception): 480 def _abort(self, exception):
481 raise exception 481 raise exception
482 482
483 class httpspeer(httppeer):
484 def __init__(self, ui, path):
485 if not url.has_https:
486 raise error.Abort(_('Python support for SSL and HTTPS '
487 'is not installed'))
488 httppeer.__init__(self, ui, path)
489
490 def instance(ui, path, create): 483 def instance(ui, path, create):
491 if create: 484 if create:
492 raise error.Abort(_('cannot create new http repository')) 485 raise error.Abort(_('cannot create new http repository'))
493 try: 486 try:
494 if path.startswith('https:'): 487 if path.startswith('https:') and not url.has_https:
495 inst = httpspeer(ui, path) 488 raise error.Abort(_('Python support for SSL and HTTPS '
496 else: 489 'is not installed'))
497 inst = httppeer(ui, path) 490
498 491 inst = httppeer(ui, path)
499 inst._fetchcaps() 492 inst._fetchcaps()
500 493
501 return inst 494 return inst
502 except error.RepoError as httpexception: 495 except error.RepoError as httpexception:
503 try: 496 try: