Mercurial > hg
comparison hgext/lfs/blobstore.py @ 37565:9c7a25ef5b49
lfs: handle paths that don't end with '/' when inferring the blob store
While here, I also checked the lfs.url config directly instead of testing the
scheme, as requested by Yuya.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 11 Apr 2018 18:23:29 -0400 |
parents | 31a4ea773369 |
children | d241e6632669 |
comparison
equal
deleted
inserted
replaced
37564:31a4ea773369 | 37565:9c7a25ef5b49 |
---|---|
537 adjustments as git. As an extension, 'http' is supported as well so that | 537 adjustments as git. As an extension, 'http' is supported as well so that |
538 ``hg serve`` works out of the box. | 538 ``hg serve`` works out of the box. |
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 lfsurl = repo.ui.config('lfs', 'url') |
543 if url.scheme is None: | 543 url = util.url(lfsurl or '') |
544 if lfsurl is None: | |
544 if remote: | 545 if remote: |
545 defaulturl = util.url(remote) | 546 path = remote |
546 elif util.safehasattr(repo, '_subtoppath'): | 547 elif util.safehasattr(repo, '_subtoppath'): |
547 # The pull command sets this during the optional update phase, which | 548 # The pull command sets this during the optional update phase, which |
548 # tells exactly where the pull originated, whether 'paths.default' | 549 # tells exactly where the pull originated, whether 'paths.default' |
549 # or explicit. | 550 # or explicit. |
550 defaulturl = util.url(repo._subtoppath) | 551 path = repo._subtoppath |
551 else: | 552 else: |
552 # TODO: investigate 'paths.remote:lfsurl' style path customization, | 553 # TODO: investigate 'paths.remote:lfsurl' style path customization, |
553 # and fall back to inferring from 'paths.remote' if unspecified. | 554 # and fall back to inferring from 'paths.remote' if unspecified. |
554 defaulturl = util.url(repo.ui.config('paths', 'default') or b'') | 555 path = repo.ui.config('paths', 'default') or '' |
556 | |
557 defaulturl = util.url(path) | |
555 | 558 |
556 # TODO: support local paths as well. | 559 # TODO: support local paths as well. |
557 # TODO: consider the ssh -> https transformation that git applies | 560 # TODO: consider the ssh -> https transformation that git applies |
558 if defaulturl.scheme in (b'http', b'https'): | 561 if defaulturl.scheme in (b'http', b'https'): |
562 if defaulturl.path and defaulturl.path[:-1] != b'/': | |
563 defaulturl.path += b'/' | |
559 defaulturl.path = defaulturl.path or b'' + b'.git/info/lfs' | 564 defaulturl.path = defaulturl.path or b'' + b'.git/info/lfs' |
560 | 565 |
561 url = util.url(bytes(defaulturl)) | 566 url = util.url(bytes(defaulturl)) |
562 repo.ui.note(_('lfs: assuming remote store: %s\n') % url) | 567 repo.ui.note(_('lfs: assuming remote store: %s\n') % url) |
563 | 568 |