# HG changeset patch # User Pierre-Yves David # Date 1670000691 -3600 # Node ID f075a9463ee7a55ef2c3ca51c292b5ed8ab62148 # Parent be3fcd9e5e52e6b9bf1243a3c782592dbe9c561a peer: use a dedicated name for the `peer` constructor We want to change the argument it takes, so we rather make them different function. diff -r be3fcd9e5e52 -r f075a9463ee7 hgext/schemes.py --- a/hgext/schemes.py Fri Dec 02 18:04:37 2022 +0100 +++ b/hgext/schemes.py Fri Dec 02 18:04:51 2022 +0100 @@ -80,6 +80,15 @@ def __repr__(self): return b'' % self.scheme + def make_peer(self, ui, url, *args, **kwargs): + url = self.resolve(url) + u = urlutil.url(url) + scheme = u.scheme or b'file' + cls = hg.peer_schemes.get(scheme) + if cls is not None: + return cls.make_peer(ui, url, *args, **kwargs) + return None + def instance(self, ui, url, create, intents=None, createopts=None): url = self.resolve(url) u = urlutil.url(url) diff -r be3fcd9e5e52 -r f075a9463ee7 mercurial/hg.py --- a/mercurial/hg.py Fri Dec 02 18:04:37 2022 +0100 +++ b/mercurial/hg.py Fri Dec 02 18:04:51 2022 +0100 @@ -168,11 +168,12 @@ scheme = u.scheme or b'file' if scheme in peer_schemes: cls = peer_schemes[scheme] + cls.make_peer # make sure we load the module elif scheme in repo_schemes: cls = repo_schemes[scheme] + cls.instance # make sure we load the module else: cls = LocalFactory - cls.instance # make sure we load the module if util.safehasattr(cls, 'islocal'): return cls.islocal(repo) # pytype: disable=module-attr return False @@ -253,7 +254,7 @@ scheme = urlutil.url(path).scheme if scheme in peer_schemes: cls = peer_schemes[scheme] - peer = cls.instance( + peer = cls.make_peer( rui, path, create, diff -r be3fcd9e5e52 -r f075a9463ee7 mercurial/httppeer.py --- a/mercurial/httppeer.py Fri Dec 02 18:04:37 2022 +0100 +++ b/mercurial/httppeer.py Fri Dec 02 18:04:51 2022 +0100 @@ -621,7 +621,7 @@ ) -def instance(ui, path, create, intents=None, createopts=None): +def make_peer(ui, path, create, intents=None, createopts=None): if create: raise error.Abort(_(b'cannot create new http repository')) try: @@ -635,7 +635,7 @@ return inst except error.RepoError as httpexception: try: - r = statichttprepo.instance(ui, b"static-" + path, create) + r = statichttprepo.make_peer(ui, b"static-" + path, create) ui.note(_(b'(falling back to static-http)\n')) return r except error.RepoError: diff -r be3fcd9e5e52 -r f075a9463ee7 mercurial/sshpeer.py --- a/mercurial/sshpeer.py Fri Dec 02 18:04:37 2022 +0100 +++ b/mercurial/sshpeer.py Fri Dec 02 18:04:51 2022 +0100 @@ -607,7 +607,7 @@ ) -def instance(ui, path, create, intents=None, createopts=None): +def make_peer(ui, path, create, intents=None, createopts=None): """Create an SSH peer. The returned object conforms to the ``wireprotov1peer.wirepeer`` interface. diff -r be3fcd9e5e52 -r f075a9463ee7 mercurial/statichttprepo.py --- a/mercurial/statichttprepo.py Fri Dec 02 18:04:37 2022 +0100 +++ b/mercurial/statichttprepo.py Fri Dec 02 18:04:51 2022 +0100 @@ -259,7 +259,7 @@ pass # statichttprepository are read only -def instance(ui, path, create, intents=None, createopts=None): +def make_peer(ui, path, create, intents=None, createopts=None): if create: raise error.Abort(_(b'cannot create new static-http repository')) return statichttprepository(ui, path[7:]).peer()