##// END OF EJS Templates
largefiles: add tests for uncovered codepaths (issue3092)...
Levi Bard -
r15810:3d11da21 default
parent child Browse files
Show More
@@ -1,233 +1,260 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > largefiles =
3 > largefiles =
4 > share =
4 > share =
5 > graphlog =
5 > graphlog =
6 > mq =
6 > [largefiles]
7 > [largefiles]
7 > minsize = 0.5
8 > minsize = 0.5
8 > patterns = **.other
9 > patterns = **.other
9 > **.dat
10 > **.dat
10 > EOF
11 > EOF
11
12
12 "lfconvert" works
13 "lfconvert" works
13 $ hg init bigfile-repo
14 $ hg init bigfile-repo
14 $ cd bigfile-repo
15 $ cd bigfile-repo
15 $ cat >> .hg/hgrc <<EOF
16 $ cat >> .hg/hgrc <<EOF
16 > [extensions]
17 > [extensions]
17 > largefiles = !
18 > largefiles = !
18 > EOF
19 > EOF
19 $ mkdir sub
20 $ mkdir sub
20 $ dd if=/dev/zero bs=1k count=256 > large 2> /dev/null
21 $ dd if=/dev/zero bs=1k count=256 > large 2> /dev/null
22 $ dd if=/dev/zero bs=1k count=256 > large2 2> /dev/null
21 $ echo normal > normal1
23 $ echo normal > normal1
22 $ echo alsonormal > sub/normal2
24 $ echo alsonormal > sub/normal2
23 $ dd if=/dev/zero bs=1k count=10 > sub/maybelarge.dat 2> /dev/null
25 $ dd if=/dev/zero bs=1k count=10 > sub/maybelarge.dat 2> /dev/null
24 $ hg addremove
26 $ hg addremove
25 adding large
27 adding large
28 adding large2
26 adding normal1
29 adding normal1
27 adding sub/maybelarge.dat
30 adding sub/maybelarge.dat
28 adding sub/normal2
31 adding sub/normal2
29 $ hg commit -m"add large, normal1" large normal1
32 $ hg commit -m"add large, normal1" large normal1
30 $ hg commit -m"add sub/*" sub
33 $ hg commit -m"add sub/*" sub
34 Test tag parsing
35 $ cat >> .hgtags <<EOF
36 > IncorrectlyFormattedTag!
37 > invalidhash sometag
38 > 0123456789abcdef anothertag
39 > EOF
40 $ hg add .hgtags
41 $ hg commit -m"add large2" large2 .hgtags
42 $ hg rename large2 large3
43 Test link+rename largefile codepath
44 $ ln -sf large large3
45 $ hg commit -m"make large2 a symlink" large2 large3
31 $ [ -d .hg/largefiles ] && echo fail || echo pass
46 $ [ -d .hg/largefiles ] && echo fail || echo pass
32 pass
47 pass
33 $ cd ..
48 $ cd ..
34 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
49 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
35 initializing destination largefiles-repo
50 initializing destination largefiles-repo
51 skipping incorrectly formatted tag IncorrectlyFormattedTag!
52 skipping incorrectly formatted id invalidhash
53 no mapping for id 0123456789abcdef
54 abort: renamed/copied largefile large3 becomes symlink
55 [255]
56 $ cd bigfile-repo
57 $ hg strip --no-backup 2
58 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
59 $ cd ..
60 $ rm -rf largefiles-repo
61 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
62 initializing destination largefiles-repo
36
63
37 "lfconvert" converts content correctly
64 "lfconvert" converts content correctly
38 $ cd largefiles-repo
65 $ cd largefiles-repo
39 $ hg up
66 $ hg up
40 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
41 getting changed largefiles
68 getting changed largefiles
42 2 largefiles updated, 0 removed
69 2 largefiles updated, 0 removed
43 $ hg locate
70 $ hg locate
44 .hglf/large
71 .hglf/large
45 .hglf/sub/maybelarge.dat
72 .hglf/sub/maybelarge.dat
46 normal1
73 normal1
47 sub/normal2
74 sub/normal2
48 $ cat normal1
75 $ cat normal1
49 normal
76 normal
50 $ cat sub/normal2
77 $ cat sub/normal2
51 alsonormal
78 alsonormal
52 $ "$TESTDIR/md5sum.py" large sub/maybelarge.dat
79 $ "$TESTDIR/md5sum.py" large sub/maybelarge.dat
53 ec87a838931d4d5d2e94a04644788a55 large
80 ec87a838931d4d5d2e94a04644788a55 large
54 1276481102f218c981e0324180bafd9f sub/maybelarge.dat
81 1276481102f218c981e0324180bafd9f sub/maybelarge.dat
55
82
56 "lfconvert" adds 'largefiles' to .hg/requires.
83 "lfconvert" adds 'largefiles' to .hg/requires.
57 $ cat .hg/requires
84 $ cat .hg/requires
58 largefiles
85 largefiles
59 revlogv1
86 revlogv1
60 fncache
87 fncache
61 store
88 store
62 dotencode
89 dotencode
63
90
64 "lfconvert" includes a newline at the end of the standin files.
91 "lfconvert" includes a newline at the end of the standin files.
65 $ cat .hglf/large .hglf/sub/maybelarge.dat
92 $ cat .hglf/large .hglf/sub/maybelarge.dat
66 2e000fa7e85759c7f4c254d4d9c33ef481e459a7
93 2e000fa7e85759c7f4c254d4d9c33ef481e459a7
67 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
94 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
68 $ cd ..
95 $ cd ..
69
96
70 add some changesets to rename/remove/merge
97 add some changesets to rename/remove/merge
71 $ cd bigfile-repo
98 $ cd bigfile-repo
72 $ hg mv -q sub stuff
99 $ hg mv -q sub stuff
73 $ hg commit -m"rename sub/ to stuff/"
100 $ hg commit -m"rename sub/ to stuff/"
74 $ hg update -q 1
101 $ hg update -q 1
75 $ echo blah >> normal3
102 $ echo blah >> normal3
76 $ echo blah >> sub/normal2
103 $ echo blah >> sub/normal2
77 $ echo blah >> sub/maybelarge.dat
104 $ echo blah >> sub/maybelarge.dat
78 $ "$TESTDIR/md5sum.py" sub/maybelarge.dat
105 $ "$TESTDIR/md5sum.py" sub/maybelarge.dat
79 1dd0b99ff80e19cff409702a1d3f5e15 sub/maybelarge.dat
106 1dd0b99ff80e19cff409702a1d3f5e15 sub/maybelarge.dat
80 $ hg commit -A -m"add normal3, modify sub/*"
107 $ hg commit -A -m"add normal3, modify sub/*"
81 adding normal3
108 adding normal3
82 created new head
109 created new head
83 $ hg rm large normal3
110 $ hg rm large normal3
84 $ hg commit -q -m"remove large, normal3"
111 $ hg commit -q -m"remove large, normal3"
85 $ hg merge
112 $ hg merge
86 merging sub/maybelarge.dat and stuff/maybelarge.dat to stuff/maybelarge.dat
113 merging sub/maybelarge.dat and stuff/maybelarge.dat to stuff/maybelarge.dat
87 warning: $TESTTMP/bigfile-repo/stuff/maybelarge.dat looks like a binary file. (glob)
114 warning: $TESTTMP/bigfile-repo/stuff/maybelarge.dat looks like a binary file. (glob)
88 merging stuff/maybelarge.dat incomplete! (edit conflicts, then use 'hg resolve --mark')
115 merging stuff/maybelarge.dat incomplete! (edit conflicts, then use 'hg resolve --mark')
89 merging sub/normal2 and stuff/normal2 to stuff/normal2
116 merging sub/normal2 and stuff/normal2 to stuff/normal2
90 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
117 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
91 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
118 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
92 [1]
119 [1]
93 $ hg cat -r . sub/maybelarge.dat > stuff/maybelarge.dat
120 $ hg cat -r . sub/maybelarge.dat > stuff/maybelarge.dat
94 $ hg resolve -m stuff/maybelarge.dat
121 $ hg resolve -m stuff/maybelarge.dat
95 $ hg commit -m"merge"
122 $ hg commit -m"merge"
96 $ hg glog --template "{rev}:{node|short} {desc|firstline}\n"
123 $ hg glog --template "{rev}:{node|short} {desc|firstline}\n"
97 @ 5:4884f215abda merge
124 @ 5:4884f215abda merge
98 |\
125 |\
99 | o 4:7285f817b77e remove large, normal3
126 | o 4:7285f817b77e remove large, normal3
100 | |
127 | |
101 | o 3:67e3892e3534 add normal3, modify sub/*
128 | o 3:67e3892e3534 add normal3, modify sub/*
102 | |
129 | |
103 o | 2:c96c8beb5d56 rename sub/ to stuff/
130 o | 2:c96c8beb5d56 rename sub/ to stuff/
104 |/
131 |/
105 o 1:020c65d24e11 add sub/*
132 o 1:020c65d24e11 add sub/*
106 |
133 |
107 o 0:117b8328f97a add large, normal1
134 o 0:117b8328f97a add large, normal1
108
135
109 $ cd ..
136 $ cd ..
110
137
111 lfconvert with rename, merge, and remove
138 lfconvert with rename, merge, and remove
112 $ rm -rf largefiles-repo
139 $ rm -rf largefiles-repo
113 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
140 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
114 initializing destination largefiles-repo
141 initializing destination largefiles-repo
115 $ cd largefiles-repo
142 $ cd largefiles-repo
116 $ hg glog --template "{rev}:{node|short} {desc|firstline}\n"
143 $ hg glog --template "{rev}:{node|short} {desc|firstline}\n"
117 o 5:8e05f5f2b77e merge
144 o 5:8e05f5f2b77e merge
118 |\
145 |\
119 | o 4:a5a02de7a8e4 remove large, normal3
146 | o 4:a5a02de7a8e4 remove large, normal3
120 | |
147 | |
121 | o 3:55759520c76f add normal3, modify sub/*
148 | o 3:55759520c76f add normal3, modify sub/*
122 | |
149 | |
123 o | 2:261ad3f3f037 rename sub/ to stuff/
150 o | 2:261ad3f3f037 rename sub/ to stuff/
124 |/
151 |/
125 o 1:334e5237836d add sub/*
152 o 1:334e5237836d add sub/*
126 |
153 |
127 o 0:d4892ec57ce2 add large, normal1
154 o 0:d4892ec57ce2 add large, normal1
128
155
129 $ hg locate -r 2
156 $ hg locate -r 2
130 .hglf/large
157 .hglf/large
131 .hglf/stuff/maybelarge.dat
158 .hglf/stuff/maybelarge.dat
132 normal1
159 normal1
133 stuff/normal2
160 stuff/normal2
134 $ hg locate -r 3
161 $ hg locate -r 3
135 .hglf/large
162 .hglf/large
136 .hglf/sub/maybelarge.dat
163 .hglf/sub/maybelarge.dat
137 normal1
164 normal1
138 normal3
165 normal3
139 sub/normal2
166 sub/normal2
140 $ hg locate -r 4
167 $ hg locate -r 4
141 .hglf/sub/maybelarge.dat
168 .hglf/sub/maybelarge.dat
142 normal1
169 normal1
143 sub/normal2
170 sub/normal2
144 $ hg locate -r 5
171 $ hg locate -r 5
145 .hglf/stuff/maybelarge.dat
172 .hglf/stuff/maybelarge.dat
146 normal1
173 normal1
147 stuff/normal2
174 stuff/normal2
148 $ hg update
175 $ hg update
149 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
176 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 getting changed largefiles
177 getting changed largefiles
151 1 largefiles updated, 0 removed
178 1 largefiles updated, 0 removed
152 $ cat stuff/normal2
179 $ cat stuff/normal2
153 alsonormal
180 alsonormal
154 blah
181 blah
155 $ "$TESTDIR/md5sum.py" stuff/maybelarge.dat
182 $ "$TESTDIR/md5sum.py" stuff/maybelarge.dat
156 1dd0b99ff80e19cff409702a1d3f5e15 stuff/maybelarge.dat
183 1dd0b99ff80e19cff409702a1d3f5e15 stuff/maybelarge.dat
157 $ cat .hglf/stuff/maybelarge.dat
184 $ cat .hglf/stuff/maybelarge.dat
158 76236b6a2c6102826c61af4297dd738fb3b1de38
185 76236b6a2c6102826c61af4297dd738fb3b1de38
159 $ cd ..
186 $ cd ..
160
187
161 "lfconvert" error cases
188 "lfconvert" error cases
162 $ hg lfconvert http://localhost/foo foo
189 $ hg lfconvert http://localhost/foo foo
163 abort: http://localhost/foo is not a local Mercurial repo
190 abort: http://localhost/foo is not a local Mercurial repo
164 [255]
191 [255]
165 $ hg lfconvert foo ssh://localhost/foo
192 $ hg lfconvert foo ssh://localhost/foo
166 abort: ssh://localhost/foo is not a local Mercurial repo
193 abort: ssh://localhost/foo is not a local Mercurial repo
167 [255]
194 [255]
168 $ hg lfconvert nosuchrepo foo
195 $ hg lfconvert nosuchrepo foo
169 abort: repository nosuchrepo not found!
196 abort: repository nosuchrepo not found!
170 [255]
197 [255]
171 $ hg share -q -U bigfile-repo shared
198 $ hg share -q -U bigfile-repo shared
172 $ printf 'bogus' > shared/.hg/sharedpath
199 $ printf 'bogus' > shared/.hg/sharedpath
173 $ hg lfconvert shared foo
200 $ hg lfconvert shared foo
174 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/bogus! (glob)
201 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/bogus! (glob)
175 [255]
202 [255]
176 $ hg lfconvert bigfile-repo largefiles-repo
203 $ hg lfconvert bigfile-repo largefiles-repo
177 initializing destination largefiles-repo
204 initializing destination largefiles-repo
178 abort: repository largefiles-repo already exists!
205 abort: repository largefiles-repo already exists!
179 [255]
206 [255]
180
207
181 add another largefile to the new largefiles repo
208 add another largefile to the new largefiles repo
182 $ cd largefiles-repo
209 $ cd largefiles-repo
183 $ dd if=/dev/zero bs=1k count=1k > anotherlarge 2> /dev/null
210 $ dd if=/dev/zero bs=1k count=1k > anotherlarge 2> /dev/null
184 $ hg add --lfsize=1 anotherlarge
211 $ hg add --lfsize=1 anotherlarge
185 $ hg commit -m "add anotherlarge (should be a largefile)"
212 $ hg commit -m "add anotherlarge (should be a largefile)"
186 $ cat .hglf/anotherlarge
213 $ cat .hglf/anotherlarge
187 3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3
214 3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3
188 $ cd ..
215 $ cd ..
189
216
190 round-trip: converting back to a normal (non-largefiles) repo with
217 round-trip: converting back to a normal (non-largefiles) repo with
191 "lfconvert --to-normal" should give the same as ../bigfile-repo
218 "lfconvert --to-normal" should give the same as ../bigfile-repo
192 $ cd largefiles-repo
219 $ cd largefiles-repo
193 $ hg lfconvert --to-normal . ../normal-repo
220 $ hg lfconvert --to-normal . ../normal-repo
194 initializing destination ../normal-repo
221 initializing destination ../normal-repo
195 $ cd ../normal-repo
222 $ cd ../normal-repo
196 $ cat >> .hg/hgrc <<EOF
223 $ cat >> .hg/hgrc <<EOF
197 > [extensions]
224 > [extensions]
198 > largefiles = !
225 > largefiles = !
199 > EOF
226 > EOF
200
227
201 # Hmmm: the changeset ID for rev 5 is different from the original
228 # Hmmm: the changeset ID for rev 5 is different from the original
202 # normal repo (../bigfile-repo), because the changelog filelist
229 # normal repo (../bigfile-repo), because the changelog filelist
203 # differs between the two incarnations of rev 5: this repo includes
230 # differs between the two incarnations of rev 5: this repo includes
204 # 'large' in the list, but ../bigfile-repo does not. Since rev 5
231 # 'large' in the list, but ../bigfile-repo does not. Since rev 5
205 # removes 'large' relative to the first parent in both repos, it seems
232 # removes 'large' relative to the first parent in both repos, it seems
206 # to me that lfconvert is doing a *better* job than
233 # to me that lfconvert is doing a *better* job than
207 # "hg remove" + "hg merge" + "hg commit".
234 # "hg remove" + "hg merge" + "hg commit".
208 # $ hg -R ../bigfile-repo debugdata -c 5
235 # $ hg -R ../bigfile-repo debugdata -c 5
209 # $ hg debugdata -c 5
236 # $ hg debugdata -c 5
210 $ hg glog --template "{rev}:{node|short} {desc|firstline}\n"
237 $ hg glog --template "{rev}:{node|short} {desc|firstline}\n"
211 o 6:1635824e6f59 add anotherlarge (should be a largefile)
238 o 6:1635824e6f59 add anotherlarge (should be a largefile)
212 |
239 |
213 o 5:7215f8deeaaf merge
240 o 5:7215f8deeaaf merge
214 |\
241 |\
215 | o 4:7285f817b77e remove large, normal3
242 | o 4:7285f817b77e remove large, normal3
216 | |
243 | |
217 | o 3:67e3892e3534 add normal3, modify sub/*
244 | o 3:67e3892e3534 add normal3, modify sub/*
218 | |
245 | |
219 o | 2:c96c8beb5d56 rename sub/ to stuff/
246 o | 2:c96c8beb5d56 rename sub/ to stuff/
220 |/
247 |/
221 o 1:020c65d24e11 add sub/*
248 o 1:020c65d24e11 add sub/*
222 |
249 |
223 o 0:117b8328f97a add large, normal1
250 o 0:117b8328f97a add large, normal1
224
251
225 $ hg update
252 $ hg update
226 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
253 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
227 $ hg locate
254 $ hg locate
228 anotherlarge
255 anotherlarge
229 normal1
256 normal1
230 stuff/maybelarge.dat
257 stuff/maybelarge.dat
231 stuff/normal2
258 stuff/normal2
232 $ [ -d .hg/largefiles ] && echo fail || echo pass
259 $ [ -d .hg/largefiles ] && echo fail || echo pass
233 pass
260 pass
General Comments 0
You need to be logged in to leave comments. Login now