Mercurial > public > mercurial-scm > hg
comparison mercurial/httppeer.py @ 49750:f075a9463ee7
peer: use a dedicated name for the `peer` constructor
We want to change the argument it takes, so we rather make them different
function.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 02 Dec 2022 18:04:51 +0100 |
parents | 78af51ba73c5 |
children | a6e2a668c746 |
comparison
equal
deleted
inserted
replaced
49749:be3fcd9e5e52 | 49750:f075a9463ee7 |
---|---|
619 return httppeer( | 619 return httppeer( |
620 ui, path, respurl, opener, requestbuilder, info[b'v1capabilities'] | 620 ui, path, respurl, opener, requestbuilder, info[b'v1capabilities'] |
621 ) | 621 ) |
622 | 622 |
623 | 623 |
624 def instance(ui, path, create, intents=None, createopts=None): | 624 def make_peer(ui, path, create, intents=None, createopts=None): |
625 if create: | 625 if create: |
626 raise error.Abort(_(b'cannot create new http repository')) | 626 raise error.Abort(_(b'cannot create new http repository')) |
627 try: | 627 try: |
628 if path.startswith(b'https:') and not urlmod.has_https: | 628 if path.startswith(b'https:') and not urlmod.has_https: |
629 raise error.Abort( | 629 raise error.Abort( |
633 inst = makepeer(ui, path) | 633 inst = makepeer(ui, path) |
634 | 634 |
635 return inst | 635 return inst |
636 except error.RepoError as httpexception: | 636 except error.RepoError as httpexception: |
637 try: | 637 try: |
638 r = statichttprepo.instance(ui, b"static-" + path, create) | 638 r = statichttprepo.make_peer(ui, b"static-" + path, create) |
639 ui.note(_(b'(falling back to static-http)\n')) | 639 ui.note(_(b'(falling back to static-http)\n')) |
640 return r | 640 return r |
641 except error.RepoError: | 641 except error.RepoError: |
642 raise httpexception # use the original http RepoError instead | 642 raise httpexception # use the original http RepoError instead |