Mercurial > kallithea
changeset 7450:1c4007ec86e8
hg: fix URL cloning with Mercurial 4.6 and later
In 03dfcbe52906, I didn't notice that the API also changed ... and it was not
sufficiently tested.
Now, instead of using the peer classes directly, use the instance wrapper.
There is no automated testing of this, but it was tested manually to also work
in the oldest supported Mercurial version.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sun, 23 Dec 2018 21:16:06 +0100 |
parents | 7651f0cbca82 |
children | 8b6e87245e57 |
files | kallithea/lib/vcs/backends/hg/repository.py kallithea/lib/vcs/utils/hgcompat.py |
diffstat | 2 files changed, 4 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/hg/repository.py Mon Dec 17 22:33:29 2018 +0100 +++ b/kallithea/lib/vcs/backends/hg/repository.py Sun Dec 23 21:16:06 2018 +0100 @@ -292,7 +292,7 @@ if url.startswith('ssh:'): # in case of invalid uri or authentication issues, sshpeer will # throw an exception. - sshpeer(repoui or ui.ui(), url).lookup('tip') + sshpeer.instance(repoui or ui.ui(), url, False).lookup('tip') return True url_prefix = None @@ -334,7 +334,7 @@ if not url_prefix: # skip svn+http://... (and git+... too) # now check if it's a proper hg repo try: - httppeer(repoui or ui.ui(), url).lookup('tip') + httppeer.instance(repoui or ui.ui(), url, False).lookup('tip') except Exception as e: raise urllib2.URLError( "url [%s] does not look like an hg repo org_exc: %s"
--- a/kallithea/lib/vcs/utils/hgcompat.py Mon Dec 17 22:33:29 2018 +0100 +++ b/kallithea/lib/vcs/utils/hgcompat.py Sun Dec 23 21:16:06 2018 +0100 @@ -13,6 +13,8 @@ from mercurial import scmutil from mercurial import config from mercurial import tags as tagsmod +from mercurial import httppeer +from mercurial import sshpeer from mercurial.commands import clone, nullid, pull from mercurial.context import memctx, memfilectx from mercurial.error import RepoError, RepoLookupError, Abort @@ -24,11 +26,6 @@ from mercurial.encoding import tolocal from mercurial.discovery import findcommonoutgoing from mercurial.hg import peer -from mercurial.httppeer import httppeer -try: # sshpeer was renamed in Mercurial 4.6 (625038cb4b1d), but v1 is still good enough - from mercurial.sshpeer import sshv1peer as sshpeer -except ImportError: - from mercurial.sshpeer import sshpeer from mercurial.util import url as hg_url from mercurial.scmutil import revrange from mercurial.node import nullrev