##// END OF EJS Templates
largefiles: beef up test-lfconvert.t so it's more thorough...
Greg Ward -
r15341:7ef13e53 stable
parent child Browse files
Show More
@@ -1,86 +1,114
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > largefiles =
3 > largefiles =
4 > share =
4 > share =
5 > [largefiles]
5 > [largefiles]
6 > minsize = 0.5
6 > minsize = 0.5
7 > patterns = **.dat
7 > patterns = **.dat
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
48 $ hg lfconvert http://localhost/foo foo
77 $ hg lfconvert http://localhost/foo foo
49 abort: http://localhost/foo is not a local Mercurial repo
78 abort: http://localhost/foo is not a local Mercurial repo
50 [255]
79 [255]
51 $ hg lfconvert foo ssh://localhost/foo
80 $ hg lfconvert foo ssh://localhost/foo
52 abort: ssh://localhost/foo is not a local Mercurial repo
81 abort: ssh://localhost/foo is not a local Mercurial repo
53 [255]
82 [255]
54 $ hg lfconvert nosuchrepo foo
83 $ hg lfconvert nosuchrepo foo
55 abort: repository nosuchrepo not found!
84 abort: repository nosuchrepo not found!
56 [255]
85 [255]
57 $ hg share -q -U bigfile-repo shared
86 $ hg share -q -U bigfile-repo shared
58 $ echo -n bogus > shared/.hg/sharedpath
87 $ echo -n bogus > shared/.hg/sharedpath
59 $ hg lfconvert shared foo
88 $ hg lfconvert shared foo
60 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/bogus!
89 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/bogus!
61 [255]
90 [255]
62 $ hg lfconvert bigfile-repo largefiles-repo
91 $ hg lfconvert bigfile-repo largefiles-repo
63 initializing destination largefiles-repo
92 initializing destination largefiles-repo
64 abort: repository largefiles-repo already exists!
93 abort: repository largefiles-repo already exists!
65 [255]
94 [255]
66
95
67 Convert back to a normal (non-largefiles) repo
96 Convert back to a normal (non-largefiles) repo
68 $ cd largefiles-repo
97 $ cd largefiles-repo
69 $ hg lfconvert --to-normal . ../normal-repo
98 $ hg lfconvert --to-normal . ../normal-repo
70 initializing destination ../normal-repo
99 initializing destination ../normal-repo
71 $ cd ../normal-repo
100 $ cd ../normal-repo
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
General Comments 0
You need to be logged in to leave comments. Login now