Mercurial > public > mercurial-scm > hg
comparison hgext/lfs/blobstore.py @ 37563:be1cc65bdb1c
lfs: infer the blob store URL from an explicit pull source
I don't see any easier way to do this because the update part of `hg pull -u`
happens outside exchange.pull(), and commands.postincoming() doesn't take a
path. So (ab)use the mechanism used by subrepos to redirect where subrepos are
pulled from when an explicit path is given. As a bonus, this should allow lfs
blobs to be pulled into a subrepo when it is checked out.
An explicit push path can be handled within exchange.push(). That can be done
next, outside of this dirty hack.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 08 Apr 2018 01:23:39 -0400 |
parents | e5cd8d1a094d |
children | 31a4ea773369 |
comparison
equal
deleted
inserted
replaced
37562:e5cd8d1a094d | 37563:be1cc65bdb1c |
---|---|
539 | 539 |
540 https://github.com/git-lfs/git-lfs/blob/master/docs/api/server-discovery.md | 540 https://github.com/git-lfs/git-lfs/blob/master/docs/api/server-discovery.md |
541 """ | 541 """ |
542 url = util.url(repo.ui.config('lfs', 'url') or '') | 542 url = util.url(repo.ui.config('lfs', 'url') or '') |
543 if url.scheme is None: | 543 if url.scheme is None: |
544 # TODO: investigate 'paths.remote:lfsurl' style path customization, | 544 if util.safehasattr(repo, '_subtoppath'): |
545 # and fall back to inferring from 'paths.remote' if unspecified. | 545 # The pull command sets this during the optional update phase, which |
546 defaulturl = util.url(repo.ui.config('paths', 'default') or b'') | 546 # tells exactly where the pull originated, whether 'paths.default' |
547 # or explicit. | |
548 defaulturl = util.url(repo._subtoppath) | |
549 else: | |
550 # TODO: investigate 'paths.remote:lfsurl' style path customization, | |
551 # and fall back to inferring from 'paths.remote' if unspecified. | |
552 defaulturl = util.url(repo.ui.config('paths', 'default') or b'') | |
547 | 553 |
548 # TODO: support local paths as well. | 554 # TODO: support local paths as well. |
549 # TODO: consider the ssh -> https transformation that git applies | 555 # TODO: consider the ssh -> https transformation that git applies |
550 if defaulturl.scheme in (b'http', b'https'): | 556 if defaulturl.scheme in (b'http', b'https'): |
551 defaulturl.path = defaulturl.path or b'' + b'.git/info/lfs' | 557 defaulturl.path = defaulturl.path or b'' + b'.git/info/lfs' |