##// END OF EJS Templates
lfs: infer the blob store URL from paths.default...
Matt Harbison -
r37536:092eff68 default
parent child Browse files
Show More
@@ -87,7 +87,9 b' Configs::'
87 # git-lfs endpoint
87 # git-lfs endpoint
88 # - file:///tmp/path
88 # - file:///tmp/path
89 # local filesystem, usually for testing
89 # local filesystem, usually for testing
90 # if unset, lfs will prompt setting this when it must use this value.
90 # if unset, lfs will assume the repository at ``paths.default`` also handles
91 # blob storage for http(s) URLs. Otherwise, lfs will prompt to set this
92 # when it must use this value.
91 # (default: unset)
93 # (default: unset)
92 url = https://example.com/repo.git/info/lfs
94 url = https://example.com/repo.git/info/lfs
93
95
@@ -532,8 +532,29 b' def _verify(oid, content):'
532 hint=_('run hg verify'))
532 hint=_('run hg verify'))
533
533
534 def remote(repo):
534 def remote(repo):
535 """remotestore factory. return a store in _storemap depending on config"""
535 """remotestore factory. return a store in _storemap depending on config
536
537 If ``lfs.url`` is specified, use that remote endpoint. Otherwise, try to
538 infer the endpoint, based on the remote repository using the same path
539 adjustments as git. As an extension, 'http' is supported as well so that
540 ``hg serve`` works out of the box.
541
542 https://github.com/git-lfs/git-lfs/blob/master/docs/api/server-discovery.md
543 """
536 url = util.url(repo.ui.config('lfs', 'url') or '')
544 url = util.url(repo.ui.config('lfs', 'url') or '')
545 if url.scheme is None:
546 # TODO: investigate 'paths.remote:lfsurl' style path customization,
547 # and fall back to inferring from 'paths.remote' if unspecified.
548 defaulturl = util.url(repo.ui.config('paths', 'default') or b'')
549
550 # TODO: support local paths as well.
551 # TODO: consider the ssh -> https transformation that git applies
552 if defaulturl.scheme in (b'http', b'https'):
553 defaulturl.path = defaulturl.path or b'' + b'.git/info/lfs'
554
555 url = util.url(bytes(defaulturl))
556 repo.ui.note(_('lfs: assuming remote store: %s\n') % url)
557
537 scheme = url.scheme
558 scheme = url.scheme
538 if scheme not in _storemap:
559 if scheme not in _storemap:
539 raise error.Abort(_('lfs: unknown url scheme: %s') % scheme)
560 raise error.Abort(_('lfs: unknown url scheme: %s') % scheme)
@@ -257,7 +257,9 b' def _prefetchfiles(repo, ctx, files):'
257 pointers.append(p)
257 pointers.append(p)
258
258
259 if pointers:
259 if pointers:
260 repo.svfs.lfsremoteblobstore.readbatch(pointers, localstore)
260 # Recalculating the repo store here allows 'paths.default' that is set
261 # on the repo by a clone command to be used for the update.
262 blobstore.remote(repo).readbatch(pointers, localstore)
261
263
262 def _canskipupload(repo):
264 def _canskipupload(repo):
263 # if remotestore is a null store, upload is a no-op and can be skipped
265 # if remotestore is a null store, upload is a no-op and can be skipped
@@ -34,7 +34,6 b' for flag \'0x2000\'!" if the extension is '
34 masked by the Internal Server Error message).
34 masked by the Internal Server Error message).
35 $ cat >> $HGRCPATH <<EOF
35 $ cat >> $HGRCPATH <<EOF
36 > [lfs]
36 > [lfs]
37 > url=file:$TESTTMP/dummy-remote/
38 > usercache = null://
37 > usercache = null://
39 > threshold=10
38 > threshold=10
40 > [web]
39 > [web]
@@ -157,6 +157,7 b' Clear the cache to force a download'
157 resolving manifests
157 resolving manifests
158 branchmerge: False, force: False, partial: False
158 branchmerge: False, force: False, partial: False
159 ancestor: 000000000000, local: 000000000000+, remote: 99a7098854a3
159 ancestor: 000000000000, local: 000000000000+, remote: 99a7098854a3
160 http auth: user foo, password ***
160 Status: 200
161 Status: 200
161 Content-Length: 311 (git-server !)
162 Content-Length: 311 (git-server !)
162 Content-Length: 352 (hg-server !)
163 Content-Length: 352 (hg-server !)
@@ -328,6 +329,7 b' Clear the cache to force a download'
328 resolving manifests
329 resolving manifests
329 branchmerge: False, force: False, partial: False
330 branchmerge: False, force: False, partial: False
330 ancestor: 99a7098854a3, local: 99a7098854a3+, remote: dfca2c9e2ef2
331 ancestor: 99a7098854a3, local: 99a7098854a3+, remote: dfca2c9e2ef2
332 http auth: user foo, password ***
331 Status: 200
333 Status: 200
332 Content-Length: 608 (git-server !)
334 Content-Length: 608 (git-server !)
333 Content-Length: 670 (hg-server !)
335 Content-Length: 670 (hg-server !)
@@ -417,6 +419,7 b' TODO: give the proper error indication f'
417 resolving manifests
419 resolving manifests
418 branchmerge: False, force: True, partial: False
420 branchmerge: False, force: True, partial: False
419 ancestor: dfca2c9e2ef2+, local: dfca2c9e2ef2+, remote: dfca2c9e2ef2
421 ancestor: dfca2c9e2ef2+, local: dfca2c9e2ef2+, remote: dfca2c9e2ef2
422 http auth: user foo, password ***
420 Status: 200
423 Status: 200
421 Content-Length: 311 (git-server !)
424 Content-Length: 311 (git-server !)
422 Content-Length: 183 (hg-server !)
425 Content-Length: 183 (hg-server !)
@@ -516,6 +519,7 b' Archive will prefetch blobs in a group'
516 $ rm -rf .hg/store/lfs `hg config lfs.usercache`
519 $ rm -rf .hg/store/lfs `hg config lfs.usercache`
517 $ hg archive --debug -r 1 ../archive
520 $ hg archive --debug -r 1 ../archive
518 http auth: user foo, password ***
521 http auth: user foo, password ***
522 http auth: user foo, password ***
519 Status: 200
523 Status: 200
520 Content-Length: 905 (git-server !)
524 Content-Length: 905 (git-server !)
521 Content-Length: 988 (hg-server !)
525 Content-Length: 988 (hg-server !)
@@ -611,6 +615,7 b' Cat will prefetch blobs in a group'
611 $ rm -rf .hg/store/lfs `hg config lfs.usercache`
615 $ rm -rf .hg/store/lfs `hg config lfs.usercache`
612 $ hg cat --debug -r 1 a b c
616 $ hg cat --debug -r 1 a b c
613 http auth: user foo, password ***
617 http auth: user foo, password ***
618 http auth: user foo, password ***
614 Status: 200
619 Status: 200
615 Content-Length: 608 (git-server !)
620 Content-Length: 608 (git-server !)
616 Content-Length: 670 (hg-server !)
621 Content-Length: 670 (hg-server !)
@@ -685,6 +690,7 b' Revert will prefetch blobs in a group'
685 reverting b
690 reverting b
686 reverting c
691 reverting c
687 reverting d
692 reverting d
693 http auth: user foo, password ***
688 Status: 200
694 Status: 200
689 Content-Length: 905 (git-server !)
695 Content-Length: 905 (git-server !)
690 Content-Length: 988 (hg-server !)
696 Content-Length: 988 (hg-server !)
@@ -781,6 +787,7 b' Check error message when the remote miss'
781 resolving manifests
787 resolving manifests
782 branchmerge: False, force: True, partial: False
788 branchmerge: False, force: True, partial: False
783 ancestor: 62fdbaf221c6+, local: 62fdbaf221c6+, remote: ef0564edf47e
789 ancestor: 62fdbaf221c6+, local: 62fdbaf221c6+, remote: ef0564edf47e
790 http auth: user foo, password ***
784 Status: 200
791 Status: 200
785 Content-Length: 308 (git-server !)
792 Content-Length: 308 (git-server !)
786 Content-Length: 186 (hg-server !)
793 Content-Length: 186 (hg-server !)
@@ -892,6 +899,7 b' Check error message when object does not'
892 resolving manifests
899 resolving manifests
893 branchmerge: False, force: False, partial: False
900 branchmerge: False, force: False, partial: False
894 ancestor: 000000000000, local: 000000000000+, remote: d2a338f184a8
901 ancestor: 000000000000, local: 000000000000+, remote: d2a338f184a8
902 http auth: user foo, password ***
895 Status: 200
903 Status: 200
896 Content-Length: 308 (git-server !)
904 Content-Length: 308 (git-server !)
897 Content-Length: 186 (hg-server !)
905 Content-Length: 186 (hg-server !)
General Comments 0
You need to be logged in to leave comments. Login now