Mercurial > hg
comparison tests/test-lfs-test-server.t @ 37518:092eff6833a7
lfs: infer the blob store URL from paths.default
If `lfs.url` is specified, it takes precedence. However, now that we support
serving blobs via hgweb, we shouldn't *require* this setting. Less
configuration is better (things will work out of the box once this is sorted
out), and git has similar functionality.
This is not a complete solution- it isn't able to infer the blob store from an
explicitly supplied path, and it should consider `paths.default-push` for push.
The pull solution for that is a bit hacky, and this alone is an improvement for
the vast majority of cases.
Even though there are only a handful of references to the saved remote store,
the location of them makes things complicated.
1) downloading files on demand in the revlog flag processor
2) copying to readonlyvfs with bundlerepo
3) downloading in the file prefetch hook
4) the canupload()/skipdownload() checks
5) uploading blobs
Since revlog doesn't have a repo or ui reference, we can't avoid creating a
remote store when the extension is loaded. While the long term goal is to make
sure the prefetch hook is invoked early for every command for efficiency, this
handling in the flag processor is needed as a last ditch fetch.
In order to support the clone command, the remote store needs to be created
later than when the extension loads, since `paths.default` isn't set until just
before the files are checked out. Therefore, this patch changes the prefetch
hook to ignore the saved reference, and build a new one.
The canupload()/skipdownload() checks simply check if the stored instance is a
`_nullremote`. Since this can only be set via `lfs.url` (which is reflected in
the saved reference), checking only the instance created when the extension
loaded is fine.
The blob uploading function is called from several places:
1) a prepush hook
2) when writing a new bundle
3) from infinitepush
The prepush hook gets an exchange.pushop, so it has a path to where the push is
going. The bundle writer and infinitepush don't. Further, bundle creation for
things like strip and amend are causing blobs to be uploaded. This seems wrong,
but I don't want to side track this sorting that out, so punt on trying to
handle explicit push paths or `paths.default-push`.
I also think that sending blobs to a remote store when pushing to a local repo
is wrong. This functionality predates the usercache, so perhaps that's the
reason for it. I've got some patches floating around to stop sending blobs
remotely in this case, and instead write directly to the other repo's blob
store. But the tests for corruption handling weren't happy with this change,
and I don't have time to rewrite them. So exclude filesystem based paths from
this for now.
I don't think there's much of a chance to implement `paths.remote:lfsurl` style
configs, given how early these are resolved vs how late the remote store is
created. But git has it, so I threw a TODO in there, in case anyone has ideas.
I have no idea why this is now doing http auth twice when it wasn't before. I
don't think the original blobstore's url is ever being used in these cases.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 07 Apr 2018 22:22:20 -0400 |
parents | f4e84dfc06fd |
children | 31a4ea773369 |
comparison
equal
deleted
inserted
replaced
37517:491edf2435a0 | 37518:092eff6833a7 |
---|---|
155 $ hg update tip --debug | 155 $ hg update tip --debug |
156 http auth: user foo, password *** | 156 http auth: user foo, password *** |
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 !) |
163 Content-Type: application/vnd.git-lfs+json | 164 Content-Type: application/vnd.git-lfs+json |
164 Date: $HTTP_DATE$ | 165 Date: $HTTP_DATE$ |
326 $ hg --repo ../repo1 update tip --debug | 327 $ hg --repo ../repo1 update tip --debug |
327 http auth: user foo, password *** | 328 http auth: user foo, password *** |
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 !) |
334 Content-Type: application/vnd.git-lfs+json | 336 Content-Type: application/vnd.git-lfs+json |
335 Date: $HTTP_DATE$ | 337 Date: $HTTP_DATE$ |
415 $ hg --repo ../repo1 update -C tip --debug | 417 $ hg --repo ../repo1 update -C tip --debug |
416 http auth: user foo, password *** | 418 http auth: user foo, password *** |
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 !) |
423 Content-Type: application/vnd.git-lfs+json | 426 Content-Type: application/vnd.git-lfs+json |
424 Date: $HTTP_DATE$ | 427 Date: $HTTP_DATE$ |
513 | 516 |
514 Archive will prefetch blobs in a group | 517 Archive will prefetch blobs in a group |
515 | 518 |
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 |
521 http auth: user foo, password *** | |
518 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 !) |
522 Content-Type: application/vnd.git-lfs+json | 526 Content-Type: application/vnd.git-lfs+json |
609 Cat will prefetch blobs in a group | 613 Cat will prefetch blobs in a group |
610 | 614 |
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 !) |
617 Content-Type: application/vnd.git-lfs+json | 622 Content-Type: application/vnd.git-lfs+json |
618 Date: $HTTP_DATE$ | 623 Date: $HTTP_DATE$ |
683 http auth: user foo, password *** | 688 http auth: user foo, password *** |
684 adding a | 689 adding a |
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 !) |
691 Content-Type: application/vnd.git-lfs+json | 697 Content-Type: application/vnd.git-lfs+json |
692 Date: $HTTP_DATE$ | 698 Date: $HTTP_DATE$ |
779 $ hg update -C '.^' --debug | 785 $ hg update -C '.^' --debug |
780 http auth: user foo, password *** | 786 http auth: user foo, password *** |
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 !) |
787 Content-Type: application/vnd.git-lfs+json | 794 Content-Type: application/vnd.git-lfs+json |
788 Date: $HTTP_DATE$ | 795 Date: $HTTP_DATE$ |
890 http auth: user foo, password *** | 897 http auth: user foo, password *** |
891 updating to branch default | 898 updating to branch default |
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 !) |
898 Content-Type: application/vnd.git-lfs+json | 906 Content-Type: application/vnd.git-lfs+json |
899 Date: $HTTP_DATE$ | 907 Date: $HTTP_DATE$ |