mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
init: wrap hgutil.url so that we can use isgitsshuri
Previously, cloning from a git ssh uri (e.g. git@github.com:user/repo.git) would prepend the local file path because Mercurial classifies this as a path (since there is no scheme at the beginning of the string). This patch fixes that by doing the same logic as before in hgutil.url so that the correct hgrc path is written.
This commit is contained in:
parent
d11745bc53
commit
2c0ba03a59
@ -128,6 +128,26 @@ def _local(path):
|
|||||||
|
|
||||||
hg.schemes['file'] = _local
|
hg.schemes['file'] = _local
|
||||||
|
|
||||||
|
# we need to wrap this so that git-like ssh paths are not prepended with a
|
||||||
|
# local filesystem path. ugh.
|
||||||
|
def _url(orig, path, **kwargs):
|
||||||
|
# we'll test for 'git@' then use our heuristic method to determine if it's
|
||||||
|
# a git uri
|
||||||
|
if not (path.startswith(os.sep) and ':' in path):
|
||||||
|
return orig(path, **kwargs)
|
||||||
|
|
||||||
|
# the file path will be everything up until the last slash right before the
|
||||||
|
# ':'
|
||||||
|
lastsep = path.rindex(os.sep, None, path.index(':')) + 1
|
||||||
|
gituri = path[lastsep:]
|
||||||
|
|
||||||
|
if util.isgitsshuri(gituri):
|
||||||
|
return orig(gituri, **kwargs)
|
||||||
|
return orig(path, **kwargs)
|
||||||
|
|
||||||
|
extensions.wrapfunction(hgutil, 'url', _url)
|
||||||
|
|
||||||
|
|
||||||
def _httpgitwrapper(orig):
|
def _httpgitwrapper(orig):
|
||||||
# we should probably test the connection but for now, we just keep it
|
# we should probably test the connection but for now, we just keep it
|
||||||
# simple and check for a url ending in '.git'
|
# simple and check for a url ending in '.git'
|
||||||
|
Loading…
Reference in New Issue
Block a user