comparison tests/test-lfconvert.t @ 15341:7ef13e53434e stable

largefiles: beef up test-lfconvert.t so it's more thorough - instead of converting a single changeset with a single file, convert two changesets which each add a mix of normal and large files - make one of the large files not-so-large, but identified as large by filename - use shorter, simpler filenames - put some files in a subdirectory - test that file contents are correctly converted - drop unnecessary cleanup step
author Greg Ward <greg@gerg.ca>
date Sat, 22 Oct 2011 14:52:05 -0400
parents 0e58513cc59a
children b2e00d67f590
comparison
equal deleted inserted replaced
15340:0e58513cc59a 15341:7ef13e53434e
8 > EOF 8 > EOF
9 9
10 "lfconvert" works 10 "lfconvert" works
11 $ hg init bigfile-repo 11 $ hg init bigfile-repo
12 $ cd bigfile-repo 12 $ cd bigfile-repo
13 $ dd if=/dev/zero bs=1k count=256 > a-large-file 2> /dev/null 13 $ cat >> .hg/hgrc <<EOF
14 > [extensions]
15 > largefiles = !
16 > EOF
17 $ mkdir sub
18 $ dd if=/dev/zero bs=1k count=256 > large 2> /dev/null
19 $ echo normal > normal1
20 $ echo alsonormal > sub/normal2
21 $ dd if=/dev/zero bs=1k count=10 > sub/maybelarge.dat 2> /dev/null
14 $ hg addremove 22 $ hg addremove
15 adding a-large-file 23 adding large
16 $ hg commit -m "add a-large-file (as a normal file)" 24 adding normal1
17 $ find .hg/largefiles 25 adding sub/maybelarge.dat
18 .hg/largefiles 26 adding sub/normal2
27 $ hg commit -m"add large, normal1" large normal1
28 $ hg commit -m"add sub/*" sub
29 $ [ -d .hg/largefiles ] && echo fail || echo pass
30 pass
19 $ cd .. 31 $ cd ..
20 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo 32 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
21 initializing destination largefiles-repo 33 initializing destination largefiles-repo
22 34
35 "lfconvert" converts content correctly
36 $ cd largefiles-repo
37 $ hg up
38 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
39 getting changed largefiles
40 2 largefiles updated, 0 removed
41 $ hg locate
42 .hglf/large
43 .hglf/sub/maybelarge.dat
44 normal1
45 sub/normal2
46 $ cat normal1
47 normal
48 $ cat sub/normal2
49 alsonormal
50 $ sha1sum large sub/maybelarge.dat
51 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 large
52 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c sub/maybelarge.dat
53
23 "lfconvert" adds 'largefiles' to .hg/requires. 54 "lfconvert" adds 'largefiles' to .hg/requires.
24 $ cat largefiles-repo/.hg/requires 55 $ cat .hg/requires
25 largefiles 56 largefiles
26 revlogv1 57 revlogv1
27 fncache 58 fncache
28 store 59 store
29 dotencode 60 dotencode
30 61
31 "lfconvert" includes a newline at the end of the standin files. 62 "lfconvert" includes a newline at the end of the standin files.
32 $ cd largefiles-repo 63 $ cat .hglf/large .hglf/sub/maybelarge.dat
33 $ hg up
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 getting changed largefiles
36 1 largefiles updated, 0 removed
37 $ cat .hglf/a-large-file
38 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 64 2e000fa7e85759c7f4c254d4d9c33ef481e459a7
39 $ dd if=/dev/zero bs=1k count=1k > another-large-file 2> /dev/null 65 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
40 $ hg add --lfsize=1 another-large-file 66
41 $ hg commit -m "add another-large-file (should be a largefile)" 67 add another largefile to the new largefiles repo
42 $ cat .hglf/a-large-file .hglf/another-large-file 68 $ dd if=/dev/zero bs=1k count=1k > anotherlarge 2> /dev/null
69 $ hg add --lfsize=1 anotherlarge
70 $ hg commit -m "add anotherlarge (should be a largefile)"
71 $ cat .hglf/large .hglf/anotherlarge
43 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 72 2e000fa7e85759c7f4c254d4d9c33ef481e459a7
44 3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3 73 3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3
45 $ cd .. 74 $ cd ..
46 75
47 "lfconvert" error cases 76 "lfconvert" error cases
72 $ cat >> .hg/hgrc <<EOF 101 $ cat >> .hg/hgrc <<EOF
73 > [extensions] 102 > [extensions]
74 > largefiles = ! 103 > largefiles = !
75 > EOF 104 > EOF
76 $ hg update 105 $ hg update
77 2 files updated, 0 files merged, 0 files removed, 0 files unresolved 106 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 $ hg locate 107 $ hg locate
79 a-large-file 108 anotherlarge
80 another-large-file 109 large
110 normal1
111 sub/maybelarge.dat
112 sub/normal2
81 $ [ -d .hg/largefiles ] && echo fail || echo pass 113 $ [ -d .hg/largefiles ] && echo fail || echo pass
82 pass 114 pass
83
84 Cleanup
85 $ cd ..
86 $ rm -rf bigfile-repo largefiles-repo normal-repo