[PATCH 3 of 6] lfs: infer the blob store URL from paths.default

Yuya Nishihara yuya at tcha.org
Mon Apr 9 09:26:37 EDT 2018


On Mon, 09 Apr 2018 00:26:43 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1523154140 14400
> #      Sat Apr 07 22:22:20 2018 -0400
> # Node ID 3d5a3d9692c0e9f3424a3eac148bef674580885f
> # Parent  f4381233ecb960307d39459ea961a0af03df442b
> lfs: infer the blob store URL from paths.default

>  def remote(repo):
> -    """remotestore factory. return a store in _storemap depending on config"""
> +    """remotestore factory. return a store in _storemap depending on config
> +
> +    If ``lfs.url`` is specified, use that remote endpoint.  Otherwise, try to
> +    infer the endpoint, based on the remote repository using the same path
> +    adjustments as git.  As an extension, 'http' is supported as well so that
> +    ``hg serve`` works out of the box.
> +
> +    https://github.com/git-lfs/git-lfs/blob/master/docs/api/server-discovery.md
> +    """
>      url = util.url(repo.ui.config('lfs', 'url') or '')
> +    if url.scheme is None:
> +        # TODO: investigate 'paths.remote:lfsurl' style path customization,
> +        # and fall back to inferring from 'paths.remote' if unspecified.
> +        defaulturl = util.url(repo.ui.config('paths', 'default') or b'')
> +
> +        # TODO: support local paths as well.
> +        if defaulturl.scheme and defaulturl.scheme != b'file':
> +            if defaulturl.scheme in (b'http', b'https', b'ssh'):
> +                defaulturl.path = defaulturl.path or b'' + b'.git/info/lfs'
> +            if defaulturl.scheme == b'ssh':
> +                defaulturl.scheme = b'https'

Maybe we shouldn't rewrite ssh to https because there's no clue that the SSH
path matches the HTTP path. Also, eventually we might add an SSH-based LFS
protocol.


More information about the Mercurial-devel mailing list