Debian Codegraph @

tests/test-lfs-test-server.t

raw
1 #require no-chg
2 #testcases git-server hg-server
3
4 #if git-server
5 #require lfs-test-server
6 #else
7 #require serve
8 #endif
9
10 #if git-server
11 $ LFS_LISTEN="tcp://:$HGPORT"
12 $ LFS_HOST="localhost:$HGPORT"
13 $ LFS_PUBLIC=1
14 $ export LFS_LISTEN LFS_HOST LFS_PUBLIC
15 #else
16 $ LFS_HOST="localhost:$HGPORT/.git/info/lfs"
17 #endif
18
19 #if no-windows git-server
20 $ lfs-test-server > lfs-server.log 2>&1 &
21 $ echo $! >> $DAEMON_PIDS
22 #endif
23
24 #if windows git-server
25 $ cat >> $TESTTMP/spawn.py <<EOF
26 > import os
27 > import subprocess
28 > import sys
29 >
30 > for path in os.environ["PATH"].split(os.pathsep):
31 > exe = os.path.join(path, 'lfs-test-server.exe')
32 > if os.path.exists(exe):
33 > with open('lfs-server.log', 'wb') as out:
34 > p = subprocess.Popen(exe, stdout=out, stderr=out)
35 > sys.stdout.write('%s\n' % p.pid)
36 > sys.exit(0)
37 > sys.exit(1)
38 > EOF
39 $ "$PYTHON" $TESTTMP/spawn.py >> $DAEMON_PIDS
40 #endif
41
42 $ cat >> $HGRCPATH <<EOF
43 > [ui]
44 > paginate=no
45 > [experimental]
46 > lfs.worker-enable = False
47 > [extensions]
48 > lfs=
49 > [lfs]
50 > url=http://foo:bar@$LFS_HOST
51 > track=all()
52 > [web]
53 > push_ssl = False
54 > allow-push = *
55 > EOF
56
57 Use a separate usercache, otherwise the server sees what the client commits, and
58 never requests a transfer.
59
60 #if hg-server
61 $ hg init server
62 $ hg --config "lfs.usercache=$TESTTMP/servercache" -R server serve -d \
63 > -p $HGPORT --pid-file=hg.pid -A $TESTTMP/access.log -E $TESTTMP/errors.log
64 $ cat hg.pid >> $DAEMON_PIDS
65 #endif
66
67 $ hg init repo1
68 $ cd repo1
69 $ echo THIS-IS-LFS > a
70 $ hg commit -m a -A a
71
72 A push can be serviced directly from the usercache if it isn't in the local
73 store.
74
75 $ hg init ../repo2
76 $ mv .hg/store/lfs .hg/store/lfs_
77 $ hg push ../repo2 --debug
78 http auth: user foo, password ***
79 pushing to ../repo2
80 http auth: user foo, password ***
81 http auth: user foo, password ***
82 query 1; heads
83 searching for changes
84 1 total queries in *s (glob)
85 listing keys for "phases"
86 checking for updated bookmarks
87 listing keys for "bookmarks"
88 lfs: computing set of blobs to upload
89 Status: 200
90 Content-Length: 309 (git-server !)
91 Content-Length: 350 (hg-server !)
92 Content-Type: application/vnd.git-lfs+json
93 Date: $HTTP_DATE$
94 Server: testing stub value (hg-server !)
95 {
96 "objects": [
97 {
98 "actions": {
99 "upload": {
100 "expires_at": "$ISO_8601_DATE_TIME$"
101 "header": {
102 "Accept": "application/vnd.git-lfs"
103 }
104 "href": "http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (git-server !)
105 "href": "http://localhost:$HGPORT/.hg/lfs/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (hg-server !)
106 }
107 }
108 "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
109 "size": 12
110 }
111 ]
112 "transfer": "basic" (hg-server !)
113 }
114 lfs: uploading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
115 Status: 200 (git-server !)
116 Status: 201 (hg-server !)
117 Content-Length: 0
118 Content-Type: text/plain; charset=utf-8 (hg-server !)
119 Date: $HTTP_DATE$
120 Server: testing stub value (hg-server !)
121 lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
122 lfs: uploaded 1 files (12 bytes)
123 1 changesets found
124 list of changesets:
125 99a7098854a3984a5c9eab0fc7a2906697b7cb5c
126 bundle2-output-bundle: "HG20", 4 parts total
127 bundle2-output-part: "replycaps" * bytes payload (glob)
128 bundle2-output-part: "check:heads" streamed payload
129 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
130 bundle2-output-part: "phase-heads" 24 bytes payload
131 bundle2-input-bundle: with-transaction
132 bundle2-input-part: "replycaps" supported
133 bundle2-input-part: total payload size * (glob)
134 bundle2-input-part: "check:heads" supported
135 bundle2-input-part: total payload size 20
136 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
137 adding changesets
138 add changeset 99a7098854a3
139 adding manifests
140 adding file changes
141 adding a revisions
142 calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
143 bundle2-input-part: total payload size 617
144 bundle2-input-part: "phase-heads" supported
145 bundle2-input-part: total payload size 24
146 bundle2-input-bundle: 4 parts total
147 updating the branch cache
148 added 1 changesets with 1 changes to 1 files
149 bundle2-output-bundle: "HG20", 1 parts total
150 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
151 bundle2-input-bundle: no-transaction
152 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
153 bundle2-input-bundle: 1 parts total
154 listing keys for "phases"
155 $ mv .hg/store/lfs_ .hg/store/lfs
156
157 Clear the cache to force a download
158 $ rm -rf `hg config lfs.usercache`
159 $ cd ../repo2
160 $ hg update tip --debug
161 http auth: user foo, password ***
162 resolving manifests
163 branchmerge: False, force: False, partial: False
164 ancestor: 000000000000, local: 000000000000+, remote: 99a7098854a3
165 http auth: user foo, password ***
166 Status: 200
167 Content-Length: 311 (git-server !)
168 Content-Length: 352 (hg-server !)
169 Content-Type: application/vnd.git-lfs+json
170 Date: $HTTP_DATE$
171 Server: testing stub value (hg-server !)
172 {
173 "objects": [
174 {
175 "actions": {
176 "download": {
177 "expires_at": "$ISO_8601_DATE_TIME$"
178 "header": {
179 "Accept": "application/vnd.git-lfs"
180 }
181 "href": "http://localhost:$HGPORT/*/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (glob)
182 }
183 }
184 "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
185 "size": 12
186 }
187 ]
188 "transfer": "basic" (hg-server !)
189 }
190 lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
191 Status: 200
192 Content-Length: 12
193 Content-Type: text/plain; charset=utf-8 (git-server !)
194 Content-Type: application/octet-stream (hg-server !)
195 Date: $HTTP_DATE$
196 Server: testing stub value (hg-server !)
197 lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
198 lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
199 lfs: downloaded 1 files (12 bytes)
200 a: remote created -> g
201 getting a
202 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
203 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204
205 When the server has some blobs already. `hg serve` doesn't offer to upload
206 blobs that it already knows about. Note that lfs-test-server is simply
207 toggling the action to 'download'. The Batch API spec says it should omit the
208 actions property completely.
209
210 $ hg mv a b
211 $ echo ANOTHER-LARGE-FILE > c
212 $ echo ANOTHER-LARGE-FILE2 > d
213 $ hg commit -m b-and-c -A b c d
214 $ hg push ../repo1 --debug
215 http auth: user foo, password ***
216 pushing to ../repo1
217 http auth: user foo, password ***
218 http auth: user foo, password ***
219 query 1; heads
220 searching for changes
221 all remote heads known locally
222 listing keys for "phases"
223 checking for updated bookmarks
224 listing keys for "bookmarks"
225 listing keys for "bookmarks"
226 lfs: computing set of blobs to upload
227 Status: 200
228 Content-Length: 901 (git-server !)
229 Content-Length: 755 (hg-server !)
230 Content-Type: application/vnd.git-lfs+json
231 Date: $HTTP_DATE$
232 Server: testing stub value (hg-server !)
233 {
234 "objects": [
235 {
236 "actions": { (git-server !)
237 "download": { (git-server !)
238 "expires_at": "$ISO_8601_DATE_TIME$" (git-server !)
239 "header": { (git-server !)
240 "Accept": "application/vnd.git-lfs" (git-server !)
241 } (git-server !)
242 "href": "http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (git-server !)
243 } (git-server !)
244 } (git-server !)
245 "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
246 "size": 12
247 }
248 {
249 "actions": {
250 "upload": {
251 "expires_at": "$ISO_8601_DATE_TIME$"
252 "header": {
253 "Accept": "application/vnd.git-lfs"
254 }
255 "href": "http://localhost:$HGPORT/*/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19" (glob)
256 }
257 }
258 "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
259 "size": 20
260 }
261 {
262 "actions": {
263 "upload": {
264 "expires_at": "$ISO_8601_DATE_TIME$"
265 "header": {
266 "Accept": "application/vnd.git-lfs"
267 }
268 "href": "http://localhost:$HGPORT/*/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998" (glob)
269 }
270 }
271 "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
272 "size": 19
273 }
274 ]
275 "transfer": "basic" (hg-server !)
276 }
277 lfs: need to transfer 2 objects (39 bytes)
278 lfs: uploading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
279 Status: 200 (git-server !)
280 Status: 201 (hg-server !)
281 Content-Length: 0
282 Content-Type: text/plain; charset=utf-8 (hg-server !)
283 Date: $HTTP_DATE$
284 Server: testing stub value (hg-server !)
285 lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
286 lfs: uploading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
287 Status: 200 (git-server !)
288 Status: 201 (hg-server !)
289 Content-Length: 0
290 Content-Type: text/plain; charset=utf-8 (hg-server !)
291 Date: $HTTP_DATE$
292 Server: testing stub value (hg-server !)
293 lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
294 lfs: uploaded 2 files (39 bytes)
295 1 changesets found
296 list of changesets:
297 dfca2c9e2ef24996aa61ba2abd99277d884b3d63
298 bundle2-output-bundle: "HG20", 5 parts total
299 bundle2-output-part: "replycaps" * bytes payload (glob)
300 bundle2-output-part: "check:phases" 24 bytes payload
301 bundle2-output-part: "check:updated-heads" streamed payload
302 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
303 bundle2-output-part: "phase-heads" 24 bytes payload
304 bundle2-input-bundle: with-transaction
305 bundle2-input-part: "replycaps" supported
306 bundle2-input-part: total payload size * (glob)
307 bundle2-input-part: "check:phases" supported
308 bundle2-input-part: total payload size 24
309 bundle2-input-part: "check:updated-heads" supported
310 bundle2-input-part: total payload size 20
311 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
312 adding changesets
313 add changeset dfca2c9e2ef2
314 adding manifests
315 adding file changes
316 adding b revisions
317 adding c revisions
318 adding d revisions
319 bundle2-input-part: total payload size 1315
320 bundle2-input-part: "phase-heads" supported
321 bundle2-input-part: total payload size 24
322 bundle2-input-bundle: 5 parts total
323 updating the branch cache
324 added 1 changesets with 3 changes to 3 files
325 bundle2-output-bundle: "HG20", 1 parts total
326 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
327 bundle2-input-bundle: no-transaction
328 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
329 bundle2-input-bundle: 1 parts total
330 listing keys for "phases"
331
332 Clear the cache to force a download
333 $ rm -rf `hg config lfs.usercache`
334 $ hg --repo ../repo1 update tip --debug
335 http auth: user foo, password ***
336 resolving manifests
337 branchmerge: False, force: False, partial: False
338 ancestor: 99a7098854a3, local: 99a7098854a3+, remote: dfca2c9e2ef2
339 http auth: user foo, password ***
340 Status: 200
341 Content-Length: 608 (git-server !)
342 Content-Length: 670 (hg-server !)
343 Content-Type: application/vnd.git-lfs+json
344 Date: $HTTP_DATE$
345 Server: testing stub value (hg-server !)
346 {
347 "objects": [
348 {
349 "actions": {
350 "download": {
351 "expires_at": "$ISO_8601_DATE_TIME$"
352 "header": {
353 "Accept": "application/vnd.git-lfs"
354 }
355 "href": "http://localhost:$HGPORT/*/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19" (glob)
356 }
357 }
358 "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
359 "size": 20
360 }
361 {
362 "actions": {
363 "download": {
364 "expires_at": "$ISO_8601_DATE_TIME$"
365 "header": {
366 "Accept": "application/vnd.git-lfs"
367 }
368 "href": "http://localhost:$HGPORT/*/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998" (glob)
369 }
370 }
371 "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
372 "size": 19
373 }
374 ]
375 "transfer": "basic" (hg-server !)
376 }
377 lfs: need to transfer 2 objects (39 bytes)
378 lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
379 Status: 200
380 Content-Length: 20
381 Content-Type: text/plain; charset=utf-8 (git-server !)
382 Content-Type: application/octet-stream (hg-server !)
383 Date: $HTTP_DATE$
384 Server: testing stub value (hg-server !)
385 lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache
386 lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
387 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
388 Status: 200
389 Content-Length: 19
390 Content-Type: text/plain; charset=utf-8 (git-server !)
391 Content-Type: application/octet-stream (hg-server !)
392 Date: $HTTP_DATE$
393 Server: testing stub value (hg-server !)
394 lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
395 lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
396 lfs: downloaded 2 files (39 bytes)
397 b: remote created -> g
398 getting b
399 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
400 c: remote created -> g
401 getting c
402 lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store
403 d: remote created -> g
404 getting d
405 lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store
406 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
407
408 Test a corrupt file download, but clear the cache first to force a download.
409 `hg serve` indicates a corrupt file without transferring it, unlike
410 lfs-test-server.
411
412 $ rm -rf `hg config lfs.usercache`
413 #if git-server
414 $ cp $TESTTMP/lfs-content/d1/1e/1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 blob
415 $ echo 'damage' > $TESTTMP/lfs-content/d1/1e/1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
416 #else
417 $ cp $TESTTMP/server/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 blob
418 $ echo 'damage' > $TESTTMP/server/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
419 #endif
420 $ rm ../repo1/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
421 $ rm ../repo1/*
422
423 TODO: give the proper error indication from `hg serve`
424
425 TODO: reconsider the except base class so that the git and hg errors yield the
426 same exit status.
427
428 $ hg --repo ../repo1 update -C tip --debug --config ui.detailed-exit-code=False
429 http auth: user foo, password ***
430 resolving manifests
431 branchmerge: False, force: True, partial: False
432 ancestor: dfca2c9e2ef2+, local: dfca2c9e2ef2+, remote: dfca2c9e2ef2
433 http auth: user foo, password ***
434 Status: 200
435 Content-Length: 311 (git-server !)
436 Content-Length: 183 (hg-server !)
437 Content-Type: application/vnd.git-lfs+json
438 Date: $HTTP_DATE$
439 Server: testing stub value (hg-server !)
440 {
441 "objects": [
442 {
443 "actions": { (git-server !)
444 "download": { (git-server !)
445 "expires_at": "$ISO_8601_DATE_TIME$" (git-server !)
446 "header": { (git-server !)
447 "Accept": "application/vnd.git-lfs" (git-server !)
448 } (git-server !)
449 "href": "http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998" (git-server !)
450 } (git-server !)
451 "error": { (hg-server !)
452 "code": 422 (hg-server !)
453 "message": "The object is corrupt" (hg-server !)
454 }
455 "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
456 "size": 19
457 }
458 ]
459 "transfer": "basic" (hg-server !)
460 }
461 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes) (git-server !)
462 Status: 200 (git-server !)
463 Content-Length: 7 (git-server !)
464 Content-Type: text/plain; charset=utf-8 (git-server !)
465 Date: $HTTP_DATE$ (git-server !)
466 abort: corrupt remote lfs object: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (git-server !)
467 abort: LFS server error for "c": Validation error (hg-server !)
468 [255]
469
470 The corrupted blob is not added to the usercache or local store
471
472 $ test -f ../repo1/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
473 [1]
474 $ test -f `hg config lfs.usercache`/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
475 [1]
476 #if git-server
477 $ cp blob $TESTTMP/lfs-content/d1/1e/1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
478 #else
479 $ cp blob $TESTTMP/server/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
480 $ rm -rf $TESTTMP/servercache/?*
481 #endif
482
483 Test a corrupted file upload
484
485 $ echo 'another lfs blob' > b
486 $ hg ci -m 'another blob'
487 $ echo 'damage' > .hg/store/lfs/objects/e6/59058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0
488 $ hg push --debug ../repo1
489 http auth: user foo, password ***
490 pushing to ../repo1
491 http auth: user foo, password ***
492 http auth: user foo, password ***
493 query 1; heads
494 searching for changes
495 all remote heads known locally
496 listing keys for "phases"
497 checking for updated bookmarks
498 listing keys for "bookmarks"
499 listing keys for "bookmarks"
500 lfs: computing set of blobs to upload
501 Status: 200
502 Content-Length: 309 (git-server !)
503 Content-Length: 350 (hg-server !)
504 Content-Type: application/vnd.git-lfs+json
505 Date: $HTTP_DATE$
506 Server: testing stub value (hg-server !)
507 {
508 "objects": [
509 {
510 "actions": {
511 "upload": {
512 "expires_at": "$ISO_8601_DATE_TIME$"
513 "header": {
514 "Accept": "application/vnd.git-lfs"
515 }
516 "href": "http://localhost:$HGPORT/*/e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0" (glob)
517 }
518 }
519 "oid": "e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0"
520 "size": 17
521 }
522 ]
523 "transfer": "basic" (hg-server !)
524 }
525 lfs: uploading e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0 (17 bytes)
526 abort: detected corrupt lfs object: e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0
527 (run hg verify)
528 [255]
529
530 Archive will prefetch blobs in a group
531
532 $ rm -rf .hg/store/lfs `hg config lfs.usercache`
533 $ hg archive --debug -r 1 ../archive
534 http auth: user foo, password ***
535 http auth: user foo, password ***
536 Status: 200
537 Content-Length: 905 (git-server !)
538 Content-Length: 988 (hg-server !)
539 Content-Type: application/vnd.git-lfs+json
540 Date: $HTTP_DATE$
541 Server: testing stub value (hg-server !)
542 {
543 "objects": [
544 {
545 "actions": {
546 "download": {
547 "expires_at": "$ISO_8601_DATE_TIME$"
548 "header": {
549 "Accept": "application/vnd.git-lfs"
550 }
551 "href": "http://localhost:$HGPORT/*/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (glob)
552 }
553 }
554 "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
555 "size": 12
556 }
557 {
558 "actions": {
559 "download": {
560 "expires_at": "$ISO_8601_DATE_TIME$"
561 "header": {
562 "Accept": "application/vnd.git-lfs"
563 }
564 "href": "http://localhost:$HGPORT/*/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19" (glob)
565 }
566 }
567 "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
568 "size": 20
569 }
570 {
571 "actions": {
572 "download": {
573 "expires_at": "$ISO_8601_DATE_TIME$"
574 "header": {
575 "Accept": "application/vnd.git-lfs"
576 }
577 "href": "http://localhost:$HGPORT/*/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998" (glob)
578 }
579 }
580 "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
581 "size": 19
582 }
583 ]
584 "transfer": "basic" (hg-server !)
585 }
586 lfs: need to transfer 3 objects (51 bytes)
587 lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
588 Status: 200
589 Content-Length: 12
590 Content-Type: text/plain; charset=utf-8 (git-server !)
591 Content-Type: application/octet-stream (hg-server !)
592 Date: $HTTP_DATE$
593 Server: testing stub value (hg-server !)
594 lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
595 lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
596 lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
597 Status: 200
598 Content-Length: 20
599 Content-Type: text/plain; charset=utf-8 (git-server !)
600 Content-Type: application/octet-stream (hg-server !)
601 Date: $HTTP_DATE$
602 Server: testing stub value (hg-server !)
603 lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache
604 lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
605 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
606 Status: 200
607 Content-Length: 19
608 Content-Type: text/plain; charset=utf-8 (git-server !)
609 Content-Type: application/octet-stream (hg-server !)
610 Date: $HTTP_DATE$
611 Server: testing stub value (hg-server !)
612 lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
613 lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
614 lfs: downloaded 3 files (51 bytes)
615 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
616 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
617 lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store
618 lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store
619 $ find ../archive | sort
620 ../archive
621 ../archive/.hg_archival.txt
622 ../archive/a
623 ../archive/b
624 ../archive/c
625 ../archive/d
626
627 Cat will prefetch blobs in a group
628
629 $ rm -rf .hg/store/lfs `hg config lfs.usercache`
630 $ hg cat --debug -r 1 a b c nonexistent
631 http auth: user foo, password ***
632 http auth: user foo, password ***
633 Status: 200
634 Content-Length: 608 (git-server !)
635 Content-Length: 670 (hg-server !)
636 Content-Type: application/vnd.git-lfs+json
637 Date: $HTTP_DATE$
638 Server: testing stub value (hg-server !)
639 {
640 "objects": [
641 {
642 "actions": {
643 "download": {
644 "expires_at": "$ISO_8601_DATE_TIME$"
645 "header": {
646 "Accept": "application/vnd.git-lfs"
647 }
648 "href": "http://localhost:$HGPORT/*/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (glob)
649 }
650 }
651 "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
652 "size": 12
653 }
654 {
655 "actions": {
656 "download": {
657 "expires_at": "$ISO_8601_DATE_TIME$"
658 "header": {
659 "Accept": "application/vnd.git-lfs"
660 }
661 "href": "http://localhost:$HGPORT/*/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998" (glob)
662 }
663 }
664 "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
665 "size": 19
666 }
667 ]
668 "transfer": "basic" (hg-server !)
669 }
670 lfs: need to transfer 2 objects (31 bytes)
671 lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
672 Status: 200
673 Content-Length: 12
674 Content-Type: text/plain; charset=utf-8 (git-server !)
675 Content-Type: application/octet-stream (hg-server !)
676 Date: $HTTP_DATE$
677 Server: testing stub value (hg-server !)
678 lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
679 lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
680 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
681 Status: 200
682 Content-Length: 19
683 Content-Type: text/plain; charset=utf-8 (git-server !)
684 Content-Type: application/octet-stream (hg-server !)
685 Date: $HTTP_DATE$
686 Server: testing stub value (hg-server !)
687 lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
688 lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
689 lfs: downloaded 2 files (31 bytes)
690 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
691 THIS-IS-LFS
692 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
693 THIS-IS-LFS
694 lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store
695 ANOTHER-LARGE-FILE
696 nonexistent: no such file in rev dfca2c9e2ef2
697
698 Revert will prefetch blobs in a group
699
700 $ rm -rf .hg/store/lfs
701 $ rm -rf `hg config lfs.usercache`
702 $ rm *
703 $ hg revert --all -r 1 --debug
704 http auth: user foo, password ***
705 http auth: user foo, password ***
706 Status: 200
707 Content-Length: 905 (git-server !)
708 Content-Length: 988 (hg-server !)
709 Content-Type: application/vnd.git-lfs+json
710 Date: $HTTP_DATE$
711 Server: testing stub value (hg-server !)
712 {
713 "objects": [
714 {
715 "actions": {
716 "download": {
717 "expires_at": "$ISO_8601_DATE_TIME$"
718 "header": {
719 "Accept": "application/vnd.git-lfs"
720 }
721 "href": "http://localhost:$HGPORT/*/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (glob)
722 }
723 }
724 "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
725 "size": 12
726 }
727 {
728 "actions": {
729 "download": {
730 "expires_at": "$ISO_8601_DATE_TIME$"
731 "header": {
732 "Accept": "application/vnd.git-lfs"
733 }
734 "href": "http://localhost:$HGPORT/*/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19" (glob)
735 }
736 }
737 "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
738 "size": 20
739 }
740 {
741 "actions": {
742 "download": {
743 "expires_at": "$ISO_8601_DATE_TIME$"
744 "header": {
745 "Accept": "application/vnd.git-lfs"
746 }
747 "href": "http://localhost:$HGPORT/*/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998" (glob)
748 }
749 }
750 "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
751 "size": 19
752 }
753 ]
754 "transfer": "basic" (hg-server !)
755 }
756 lfs: need to transfer 3 objects (51 bytes)
757 lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
758 Status: 200
759 Content-Length: 12
760 Content-Type: text/plain; charset=utf-8 (git-server !)
761 Content-Type: application/octet-stream (hg-server !)
762 Date: $HTTP_DATE$
763 Server: testing stub value (hg-server !)
764 lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
765 lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
766 lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
767 Status: 200
768 Content-Length: 20
769 Content-Type: text/plain; charset=utf-8 (git-server !)
770 Content-Type: application/octet-stream (hg-server !)
771 Date: $HTTP_DATE$
772 Server: testing stub value (hg-server !)
773 lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache
774 lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
775 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
776 Status: 200
777 Content-Length: 19
778 Content-Type: text/plain; charset=utf-8 (git-server !)
779 Content-Type: application/octet-stream (hg-server !)
780 Date: $HTTP_DATE$
781 Server: testing stub value (hg-server !)
782 lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
783 lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
784 lfs: downloaded 3 files (51 bytes)
785 reverting b
786 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
787 reverting c
788 lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store
789 reverting d
790 lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store
791 adding a
792 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
793
794 Check error message when the remote missed a blob:
795
796 $ echo FFFFF > b
797 $ hg commit -m b -A b
798 $ echo FFFFF >> b
799 $ hg commit -m b b
800 $ rm -rf .hg/store/lfs
801 $ rm -rf `hg config lfs.usercache`
802 $ hg update -C '.^' --debug
803 http auth: user foo, password ***
804 resolving manifests
805 branchmerge: False, force: True, partial: False
806 ancestor: 62fdbaf221c6+, local: 62fdbaf221c6+, remote: ef0564edf47e
807 http auth: user foo, password ***
808 Status: 200
809 Content-Length: 308 (git-server !)
810 Content-Length: 186 (hg-server !)
811 Content-Type: application/vnd.git-lfs+json
812 Date: $HTTP_DATE$
813 Server: testing stub value (hg-server !)
814 {
815 "objects": [
816 {
817 "actions": { (git-server !)
818 "upload": { (git-server !)
819 "expires_at": "$ISO_8601_DATE_TIME$" (git-server !)
820 "header": { (git-server !)
821 "Accept": "application/vnd.git-lfs" (git-server !)
822 } (git-server !)
823 "href": "http://localhost:$HGPORT/objects/8e6ea5f6c066b44a0efa43bcce86aea73f17e6e23f0663df0251e7524e140a13" (git-server !)
824 } (git-server !)
825 "error": { (hg-server !)
826 "code": 404 (hg-server !)
827 "message": "The object does not exist" (hg-server !)
828 }
829 "oid": "8e6ea5f6c066b44a0efa43bcce86aea73f17e6e23f0663df0251e7524e140a13"
830 "size": 6
831 }
832 ]
833 "transfer": "basic" (hg-server !)
834 }
835 abort: LFS server error for "b": The object does not exist
836 [50]
837
838 Check error message when object does not exist:
839
840 $ cd $TESTTMP
841 $ hg init test && cd test
842 $ echo "[extensions]" >> .hg/hgrc
843 $ echo "lfs=" >> .hg/hgrc
844 $ echo "[lfs]" >> .hg/hgrc
845 $ echo "threshold=1" >> .hg/hgrc
846 $ echo a > a
847 $ hg add a
848 $ hg commit -m 'test'
849 $ echo aaaaa > a
850 $ hg commit -m 'largefile'
851 $ hg debugdata a 1 # verify this is no the file content but includes "oid", the LFS "pointer".
852 version https://git-lfs.github.com/spec/v1
853 oid sha256:bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a
854 size 6
855 x-is-binary 0
856 $ cd ..
857 $ rm -rf `hg config lfs.usercache`
858
859 (Restart the server in a different location so it no longer has the content)
860
861 $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
862 *Terminated: * (glob) (?)
863
864 #if hg-server
865 $ cat $TESTTMP/access.log $TESTTMP/errors.log
866 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
867 $LOCALIP - - [$LOGDATE$] "PUT /.hg/lfs/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1" 201 - (glob)
868 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
869 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1" 200 - (glob)
870 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
871 $LOCALIP - - [$LOGDATE$] "PUT /.hg/lfs/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 HTTP/1.1" 201 - (glob)
872 $LOCALIP - - [$LOGDATE$] "PUT /.hg/lfs/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 HTTP/1.1" 201 - (glob)
873 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
874 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 HTTP/1.1" 200 - (glob)
875 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 HTTP/1.1" 200 - (glob)
876 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
877 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
878 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
879 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1" 200 - (glob)
880 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 HTTP/1.1" 200 - (glob)
881 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 HTTP/1.1" 200 - (glob)
882 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
883 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1" 200 - (glob)
884 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 HTTP/1.1" 200 - (glob)
885 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
886 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1" 200 - (glob)
887 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 HTTP/1.1" 200 - (glob)
888 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 HTTP/1.1" 200 - (glob)
889 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
890 #endif
891
892 $ mkdir $TESTTMP/lfs-server2
893 $ cd $TESTTMP/lfs-server2
894 #if no-windows git-server
895 $ lfs-test-server > lfs-server.log 2>&1 &
896 $ echo $! >> $DAEMON_PIDS
897 #endif
898
899 #if windows git-server
900 $ "$PYTHON" $TESTTMP/spawn.py >> $DAEMON_PIDS
901 #endif
902
903 #if hg-server
904 $ hg init server2
905 $ hg --config "lfs.usercache=$TESTTMP/servercache2" -R server2 serve -d \
906 > -p $HGPORT --pid-file=hg.pid -A $TESTTMP/access.log -E $TESTTMP/errors.log
907 $ cat hg.pid >> $DAEMON_PIDS
908 #endif
909
910 $ cd $TESTTMP
911 $ hg --debug clone test test2
912 http auth: user foo, password ***
913 linked 7 files (no-rust !)
914 linked 9 files (rust !)
915 http auth: user foo, password ***
916 updating to branch default
917 resolving manifests
918 branchmerge: False, force: False, partial: False
919 ancestor: 000000000000, local: 000000000000+, remote: d2a338f184a8
920 http auth: user foo, password ***
921 Status: 200
922 Content-Length: 308 (git-server !)
923 Content-Length: 186 (hg-server !)
924 Content-Type: application/vnd.git-lfs+json
925 Date: $HTTP_DATE$
926 Server: testing stub value (hg-server !)
927 {
928 "objects": [
929 {
930 "actions": { (git-server !)
931 "upload": { (git-server !)
932 "expires_at": "$ISO_8601_DATE_TIME$" (git-server !)
933 "header": { (git-server !)
934 "Accept": "application/vnd.git-lfs" (git-server !)
935 } (git-server !)
936 "href": "http://localhost:$HGPORT/objects/bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a" (git-server !)
937 } (git-server !)
938 "error": { (hg-server !)
939 "code": 404 (hg-server !)
940 "message": "The object does not exist" (hg-server !)
941 }
942 "oid": "bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a"
943 "size": 6
944 }
945 ]
946 "transfer": "basic" (hg-server !)
947 }
948 abort: LFS server error for "a": The object does not exist
949 [50]
950
951 $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
952 *Terminated: * (glob) (?)
953