##// 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 Configs::
87 87 # git-lfs endpoint
88 88 # - file:///tmp/path
89 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 93 # (default: unset)
92 94 url = https://example.com/repo.git/info/lfs
93 95
@@ -532,8 +532,29 def _verify(oid, content):
532 532 hint=_('run hg verify'))
533 533
534 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 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 558 scheme = url.scheme
538 559 if scheme not in _storemap:
539 560 raise error.Abort(_('lfs: unknown url scheme: %s') % scheme)
@@ -257,7 +257,9 def _prefetchfiles(repo, ctx, files):
257 257 pointers.append(p)
258 258
259 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 264 def _canskipupload(repo):
263 265 # if remotestore is a null store, upload is a no-op and can be skipped
@@ -34,7 +34,6 for flag '0x2000'!" if the extension is
34 34 masked by the Internal Server Error message).
35 35 $ cat >> $HGRCPATH <<EOF
36 36 > [lfs]
37 > url=file:$TESTTMP/dummy-remote/
38 37 > usercache = null://
39 38 > threshold=10
40 39 > [web]
@@ -157,6 +157,7 Clear the cache to force a download
157 157 resolving manifests
158 158 branchmerge: False, force: False, partial: False
159 159 ancestor: 000000000000, local: 000000000000+, remote: 99a7098854a3
160 http auth: user foo, password ***
160 161 Status: 200
161 162 Content-Length: 311 (git-server !)
162 163 Content-Length: 352 (hg-server !)
@@ -328,6 +329,7 Clear the cache to force a download
328 329 resolving manifests
329 330 branchmerge: False, force: False, partial: False
330 331 ancestor: 99a7098854a3, local: 99a7098854a3+, remote: dfca2c9e2ef2
332 http auth: user foo, password ***
331 333 Status: 200
332 334 Content-Length: 608 (git-server !)
333 335 Content-Length: 670 (hg-server !)
@@ -417,6 +419,7 TODO: give the proper error indication f
417 419 resolving manifests
418 420 branchmerge: False, force: True, partial: False
419 421 ancestor: dfca2c9e2ef2+, local: dfca2c9e2ef2+, remote: dfca2c9e2ef2
422 http auth: user foo, password ***
420 423 Status: 200
421 424 Content-Length: 311 (git-server !)
422 425 Content-Length: 183 (hg-server !)
@@ -516,6 +519,7 Archive will prefetch blobs in a group
516 519 $ rm -rf .hg/store/lfs `hg config lfs.usercache`
517 520 $ hg archive --debug -r 1 ../archive
518 521 http auth: user foo, password ***
522 http auth: user foo, password ***
519 523 Status: 200
520 524 Content-Length: 905 (git-server !)
521 525 Content-Length: 988 (hg-server !)
@@ -611,6 +615,7 Cat will prefetch blobs in a group
611 615 $ rm -rf .hg/store/lfs `hg config lfs.usercache`
612 616 $ hg cat --debug -r 1 a b c
613 617 http auth: user foo, password ***
618 http auth: user foo, password ***
614 619 Status: 200
615 620 Content-Length: 608 (git-server !)
616 621 Content-Length: 670 (hg-server !)
@@ -685,6 +690,7 Revert will prefetch blobs in a group
685 690 reverting b
686 691 reverting c
687 692 reverting d
693 http auth: user foo, password ***
688 694 Status: 200
689 695 Content-Length: 905 (git-server !)
690 696 Content-Length: 988 (hg-server !)
@@ -781,6 +787,7 Check error message when the remote miss
781 787 resolving manifests
782 788 branchmerge: False, force: True, partial: False
783 789 ancestor: 62fdbaf221c6+, local: 62fdbaf221c6+, remote: ef0564edf47e
790 http auth: user foo, password ***
784 791 Status: 200
785 792 Content-Length: 308 (git-server !)
786 793 Content-Length: 186 (hg-server !)
@@ -892,6 +899,7 Check error message when object does not
892 899 resolving manifests
893 900 branchmerge: False, force: False, partial: False
894 901 ancestor: 000000000000, local: 000000000000+, remote: d2a338f184a8
902 http auth: user foo, password ***
895 903 Status: 200
896 904 Content-Length: 308 (git-server !)
897 905 Content-Length: 186 (hg-server !)
General Comments 0
You need to be logged in to leave comments. Login now