sapling/tests/test-lfs-test-server.t
Jun Wu d5a9c91ff9 lfs: move batch API to a separate method
Summary:
The LFS uploading or downloading process consists of 2 parts: a batch API to
get metadata about objects, followed by `len(objects)` requests.

This diff moves the first metadata API out from a giant `_batch` method to
make the code structure easier to maintain. Later diffs will further split
`_batch` method.

A side effect is `lfs: mapping blobs to #{action} URLs` message is removed.
More user-friendly message will be added back in a later patch.

Reviewers: #mercurial, davidsp, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5057541

Signature: t1:5057541:1494949989:d510c3d9369744e7ee776c0d0a26d263dfaf8352
2017-05-16 12:24:20 -07:00

58 lines
1.4 KiB
Perl

Require lfs-test-server (https://github.com/git-lfs/lfs-test-server)
$ hash lfs-test-server || { echo 'skipped: missing lfs-test-server'; exit 80; }
$ LFS_LISTEN="tcp://:$HGPORT"
$ LFS_HOST="localhost:$HGPORT"
$ LFS_PUBLIC=1
$ export LFS_LISTEN LFS_HOST LFS_PUBLIC
$ lfs-test-server &> lfs-server.log &
$ echo $! >> $DAEMON_PIDS
$ cat >> $HGRCPATH <<EOF
> [extensions]
> lfs=$TESTDIR/../hgext3rd/lfs
> [lfs]
> url=http://foo:bar@$LFS_HOST/
> threshold=1
> EOF
$ hg init repo1
$ cd repo1
$ echo THIS-IS-LFS > a
$ hg commit -m a -A a
$ hg init ../repo2
$ hg push ../repo2 -v
pushing to ../repo2
searching for changes
lfs: computing set of blobs to upload
lfs: upload completed
1 changesets found
uncompressed size of bundle content:
* (changelog) (glob)
* (manifests) (glob)
* a (glob)
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
$ cd ../repo2
$ hg update tip -v
resolving manifests
getting a
lfs: download completed
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Check error message when the remote missed a blob:
$ echo FFFFF > b
$ hg commit -m b -A b
$ echo FFFFF >> b
$ hg commit -m b b
$ rm -rf .hg/store/lfs
$ hg update -C '.^'
abort: cannot download LFS object 8e6ea5f6c066b44a0efa43bcce86aea73f17e6e23f0663df0251e7524e140a13* (glob)
[255]