Skip to content
Snippets Groups Projects
Commit ada43aa3bf76 authored by Dan Villiom Podlaski Christiansen's avatar Dan Villiom Podlaski Christiansen
Browse files

compat: add support for mercurial 5.8

parent 96dbd036ef7e
No related branches found
No related tags found
2 merge requests!100compat: add support for mercurial 5.8 & default,!99compat: add support for mercurial 5.8 & default
......@@ -127,7 +127,6 @@
exchange,
extensions,
hg,
ui as hgui,
util as hgutil,
localrepo,
manifest,
......@@ -200,7 +199,7 @@
def _local(path):
p = hgutil.url(path).localpath()
p = compat.url(path).localpath()
if _isgitdir(p):
return gitrepo
# detect git ssh urls (which mercurial thinks is a file-like path)
......@@ -520,9 +519,15 @@
return orig(self, path) or _isgitdir(path)
if (hgutil.safehasattr(hgui, b'path') and
hgutil.safehasattr(hgui.path, b'_isvalidlocalpath')):
extensions.wrapfunction(hgui.path, b'_isvalidlocalpath', isvalidlocalpath)
extensions.wrapfunction(compat.path, b'_isvalidlocalpath', isvalidlocalpath)
def isurllocal(orig, path):
# recognise git scp-style paths when cloning
return orig(path) and not util.isgitsshuri(path._origpath)
extensions.wrapfunction(compat.url, b'islocal', isurllocal)
def islocal(orig, path):
......@@ -538,7 +543,7 @@
return orig(path) or util.isgitsshuri(path)
extensions.wrapfunction(hgutil, b'hasscheme', hasscheme)
extensions.wrapfunction(compat.urlutil, b'hasscheme', hasscheme)
@util.transform_notgit
......
......@@ -49,6 +49,17 @@
itervalues = lambda x: x.itervalues()
try:
# added in 5.8
from mercurial.utils import urlutil
url = urlutil.url
path = urlutil.path
except ImportError:
urlutil = hgutil
url = hgutil.url
path = ui.path
try:
from mercurial.cmdutil import check_at_most_one_arg
except (ImportError, AttributeError):
# added in 5.3
......
......@@ -1860,7 +1860,7 @@
# not available in dulwich 0.19, used on Python 2.7
if hasattr(client, 'get_credentials_from_store'):
urlobj = hgutil.url(uri)
urlobj = compat.url(uri)
auth = client.get_credentials_from_store(
urlobj.scheme,
urlobj.host,
......@@ -1894,7 +1894,7 @@
)
if uri.startswith(b'file://'):
return client.LocalGitClient(), hgutil.url(uri).path
return client.LocalGitClient(), compat.url(uri).path
# if its not git or git+ssh, try a local url..
return client.SubprocessGitClient(), uri
......@@ -3,7 +3,6 @@
from .util import isgitsshuri
from mercurial import (
error,
util
)
from . import compat
......@@ -158,5 +157,5 @@
if isgitsshuri(path):
return True
u = util.url(path)
u = compat.url(path)
return not u.scheme or u.scheme == b'file'
......@@ -88,6 +88,8 @@
$ hg add thefile
$ fn_hg_commit -m 'add the file'
$ hg book -r tip master
$ hg path default
git@git-server:/srv/repo.git
$ hg push
Warning: Permanently added * (glob) (?)
pushing to git@git-server:/srv/repo.git
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment