##// END OF EJS Templates
tests: prevent enormous output spew in test-lfs-largefiles.t...
Augie Fackler -
r36668:9318babf default
parent child Browse files
Show More
@@ -1,354 +1,357
1 1 This tests the interaction between the largefiles and lfs extensions, and
2 2 conversion from largefiles -> lfs.
3 3
4 4 $ cat >> $HGRCPATH << EOF
5 5 > [extensions]
6 6 > largefiles =
7 7 >
8 8 > [lfs]
9 9 > # standin files are 41 bytes. Stay bigger for clarity.
10 10 > threshold = 42
11 11 > EOF
12 12
13 13 Setup a repo with a normal file and a largefile, above and below the lfs
14 14 threshold to test lfconvert. *.txt start life as a normal file; *.bin start as
15 15 an lfs/largefile.
16 16
17 17 $ hg init largefiles
18 18 $ cd largefiles
19 19 $ echo 'normal' > normal.txt
20 20 $ echo 'normal above lfs threshold 0000000000000000000000000' > lfs.txt
21 21 $ hg ci -Am 'normal.txt'
22 22 adding lfs.txt
23 23 adding normal.txt
24 24 $ echo 'largefile' > large.bin
25 25 $ echo 'largefile above lfs threshold 0000000000000000000000' > lfs.bin
26 26 $ hg add --large large.bin lfs.bin
27 27 $ hg ci -m 'add largefiles'
28 28
29 29 $ cat >> $HGRCPATH << EOF
30 30 > [extensions]
31 31 > lfs =
32 32 > EOF
33 33
34 34 Add an lfs file and normal file that collide with files on the other branch.
35 35 large.bin is added as a normal file, and is named as such only to clash with the
36 36 largefile on the other branch.
37 37
38 38 $ hg up -q '.^'
39 39 $ echo 'below lfs threshold' > large.bin
40 40 $ echo 'lfs above the lfs threshold for length 0000000000000' > lfs.bin
41 41 $ hg ci -Am 'add with lfs extension'
42 42 adding large.bin
43 43 adding lfs.bin
44 44 created new head
45 45
46 46 $ hg log -G
47 47 @ changeset: 2:e989d0fa3764
48 48 | tag: tip
49 49 | parent: 0:29361292f54d
50 50 | user: test
51 51 | date: Thu Jan 01 00:00:00 1970 +0000
52 52 | summary: add with lfs extension
53 53 |
54 54 | o changeset: 1:6513aaab9ca0
55 55 |/ user: test
56 56 | date: Thu Jan 01 00:00:00 1970 +0000
57 57 | summary: add largefiles
58 58 |
59 59 o changeset: 0:29361292f54d
60 60 user: test
61 61 date: Thu Jan 01 00:00:00 1970 +0000
62 62 summary: normal.txt
63 63
64 64 --------------------------------------------------------------------------------
65 65 Merge largefiles into lfs branch
66 66
67 67 The largefiles extension will prompt to use the normal or largefile when merged
68 68 into the lfs files. `hg manifest` will show standins if present. They aren't,
69 69 because largefiles merge doesn't merge content. If it did, selecting (n)ormal
70 70 would convert to lfs on commit, if appropriate.
71 71
72 72 BUG: Largefiles isn't running the merge tool, like when two lfs files are
73 73 merged. This is probably by design, but it should probably at least prompt if
74 74 content should be taken from (l)ocal or (o)ther as well.
75 75
76 76 $ hg --config ui.interactive=True merge 6513aaab9ca0 <<EOF
77 77 > n
78 78 > n
79 79 > EOF
80 80 remote turned local normal file large.bin into a largefile
81 81 use (l)argefile or keep (n)ormal file? n
82 82 remote turned local normal file lfs.bin into a largefile
83 83 use (l)argefile or keep (n)ormal file? n
84 84 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 85 (branch merge, don't forget to commit)
86 86 $ hg ci -m 'merge lfs with largefiles -> normal'
87 87 $ hg manifest
88 88 large.bin
89 89 lfs.bin
90 90 lfs.txt
91 91 normal.txt
92 92
93 93 The merged lfs.bin resolved to lfs because the (n)ormal option was picked. The
94 94 lfs.txt file is unchanged by the merge, because it was added before lfs was
95 95 enabled, and the content didn't change.
96 96 $ hg debugdata lfs.bin 0
97 97 version https://git-lfs.github.com/spec/v1
98 98 oid sha256:81c7492b2c05e130431f65a87651b54a30c5da72c99ce35a1e9b9872a807312b
99 99 size 53
100 100 x-is-binary 0
101 101 $ hg debugdata lfs.txt 0
102 102 normal above lfs threshold 0000000000000000000000000
103 103
104 104 Another filelog entry is NOT made by the merge, so nothing is committed as lfs.
105 105 $ hg log -r . -T '{join(lfs_files, ", ")}\n'
106 106
107 107
108 108 Replay the last merge, but pick (l)arge this time. The manifest will show any
109 109 standins.
110 110
111 111 $ hg up -Cq e989d0fa3764
112 112
113 113 $ hg --config ui.interactive=True merge 6513aaab9ca0 <<EOF
114 114 > l
115 115 > l
116 116 > EOF
117 117 remote turned local normal file large.bin into a largefile
118 118 use (l)argefile or keep (n)ormal file? l
119 119 remote turned local normal file lfs.bin into a largefile
120 120 use (l)argefile or keep (n)ormal file? l
121 121 getting changed largefiles
122 122 2 largefiles updated, 0 removed
123 123 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
124 124 (branch merge, don't forget to commit)
125 125 $ hg ci -m 'merge lfs with largefiles -> large'
126 126 created new head
127 127 $ hg manifest
128 128 .hglf/large.bin
129 129 .hglf/lfs.bin
130 130 lfs.txt
131 131 normal.txt
132 132
133 133 --------------------------------------------------------------------------------
134 134 Merge lfs into largefiles branch
135 135
136 136 $ hg up -Cq 6513aaab9ca0
137 137 $ hg --config ui.interactive=True merge e989d0fa3764 <<EOF
138 138 > n
139 139 > n
140 140 > EOF
141 141 remote turned local largefile large.bin into a normal file
142 142 keep (l)argefile or use (n)ormal file? n
143 143 remote turned local largefile lfs.bin into a normal file
144 144 keep (l)argefile or use (n)ormal file? n
145 145 getting changed largefiles
146 146 0 largefiles updated, 0 removed
147 147 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
148 148 (branch merge, don't forget to commit)
149 149 $ hg ci -m 'merge largefiles with lfs -> normal'
150 150 created new head
151 151 $ hg manifest
152 152 large.bin
153 153 lfs.bin
154 154 lfs.txt
155 155 normal.txt
156 156
157 157 The merged lfs.bin got converted to lfs because the (n)ormal option was picked.
158 158 The lfs.txt file is unchanged by the merge, because it was added before lfs was
159 159 enabled.
160 160 $ hg debugdata lfs.bin 0
161 161 version https://git-lfs.github.com/spec/v1
162 162 oid sha256:81c7492b2c05e130431f65a87651b54a30c5da72c99ce35a1e9b9872a807312b
163 163 size 53
164 164 x-is-binary 0
165 165 $ hg debugdata lfs.txt 0
166 166 normal above lfs threshold 0000000000000000000000000
167 167
168 168 Another filelog entry is NOT made by the merge, so nothing is committed as lfs.
169 169 $ hg log -r . -T '{join(lfs_files, ", ")}\n'
170 170
171 171
172 172 Replay the last merge, but pick (l)arge this time. The manifest will show the
173 173 standins.
174 174
175 175 $ hg up -Cq 6513aaab9ca0
176 176
177 177 $ hg --config ui.interactive=True merge e989d0fa3764 <<EOF
178 178 > l
179 179 > l
180 180 > EOF
181 181 remote turned local largefile large.bin into a normal file
182 182 keep (l)argefile or use (n)ormal file? l
183 183 remote turned local largefile lfs.bin into a normal file
184 184 keep (l)argefile or use (n)ormal file? l
185 185 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 186 (branch merge, don't forget to commit)
187 187 $ hg ci -m 'merge largefiles with lfs -> large'
188 188 created new head
189 189 $ hg manifest
190 190 .hglf/large.bin
191 191 .hglf/lfs.bin
192 192 lfs.txt
193 193 normal.txt
194 194
195 195 --------------------------------------------------------------------------------
196 196
197 197 When both largefiles and lfs are configured to add by size, the tie goes to
198 198 largefiles since it hooks cmdutil.add() and lfs hooks the filelog write in the
199 199 commit. By the time the commit occurs, the tracked file is smaller than the
200 200 threshold (assuming it is > 41, so the standins don't become lfs objects).
201 201
202 202 $ $PYTHON -c 'import sys ; sys.stdout.write("y\n" * 1048576)' > large_by_size.bin
203 203 $ hg --config largefiles.minsize=1 ci -Am 'large by size'
204 204 adding large_by_size.bin as a largefile
205 205 $ hg manifest
206 206 .hglf/large.bin
207 207 .hglf/large_by_size.bin
208 208 .hglf/lfs.bin
209 209 lfs.txt
210 210 normal.txt
211 211
212 212 $ hg rm large_by_size.bin
213 213 $ hg ci -m 'remove large_by_size.bin'
214 214
215 215 Largefiles doesn't do anything special with diff, so it falls back to diffing
216 216 the standins. Extdiff also is standin based comparison. Diff and extdiff both
217 217 work on the original file for lfs objects.
218 218
219 219 Largefile -> lfs transition
220 220 $ hg diff -r 1 -r 3
221 221 diff -r 6513aaab9ca0 -r dcc5ce63e252 .hglf/large.bin
222 222 --- a/.hglf/large.bin Thu Jan 01 00:00:00 1970 +0000
223 223 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
224 224 @@ -1,1 +0,0 @@
225 225 -cef9a458373df9b0743a0d3c14d0c66fb19b8629
226 226 diff -r 6513aaab9ca0 -r dcc5ce63e252 .hglf/lfs.bin
227 227 --- a/.hglf/lfs.bin Thu Jan 01 00:00:00 1970 +0000
228 228 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
229 229 @@ -1,1 +0,0 @@
230 230 -557fb6309cef935e1ac2c8296508379e4b15a6e6
231 231 diff -r 6513aaab9ca0 -r dcc5ce63e252 large.bin
232 232 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
233 233 +++ b/large.bin Thu Jan 01 00:00:00 1970 +0000
234 234 @@ -0,0 +1,1 @@
235 235 +below lfs threshold
236 236 diff -r 6513aaab9ca0 -r dcc5ce63e252 lfs.bin
237 237 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
238 238 +++ b/lfs.bin Thu Jan 01 00:00:00 1970 +0000
239 239 @@ -0,0 +1,1 @@
240 240 +lfs above the lfs threshold for length 0000000000000
241 241
242 242 lfs -> largefiles transition
243 243 $ hg diff -r 2 -r 6
244 244 diff -r e989d0fa3764 -r 95e1e80325c8 .hglf/large.bin
245 245 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
246 246 +++ b/.hglf/large.bin Thu Jan 01 00:00:00 1970 +0000
247 247 @@ -0,0 +1,1 @@
248 248 +cef9a458373df9b0743a0d3c14d0c66fb19b8629
249 249 diff -r e989d0fa3764 -r 95e1e80325c8 .hglf/lfs.bin
250 250 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
251 251 +++ b/.hglf/lfs.bin Thu Jan 01 00:00:00 1970 +0000
252 252 @@ -0,0 +1,1 @@
253 253 +557fb6309cef935e1ac2c8296508379e4b15a6e6
254 254 diff -r e989d0fa3764 -r 95e1e80325c8 large.bin
255 255 --- a/large.bin Thu Jan 01 00:00:00 1970 +0000
256 256 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
257 257 @@ -1,1 +0,0 @@
258 258 -below lfs threshold
259 259 diff -r e989d0fa3764 -r 95e1e80325c8 lfs.bin
260 260 --- a/lfs.bin Thu Jan 01 00:00:00 1970 +0000
261 261 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
262 262 @@ -1,1 +0,0 @@
263 263 -lfs above the lfs threshold for length 0000000000000
264 264
265 265 A largefiles repo can be converted to lfs. The lfconvert command uses the
266 266 convert extension under the hood with --to-normal. So the --config based
267 267 parameters are available, but not --authormap, --branchmap, etc.
268 268
269 269 $ cd ..
270 270 $ hg lfconvert --to-normal largefiles nolargefiles 2>&1
271 271 initializing destination nolargefiles
272 272 0 additional largefiles cached
273 273 scanning source...
274 274 sorting...
275 275 converting...
276 276 8 normal.txt
277 277 7 add largefiles
278 278 6 add with lfs extension
279 279 5 merge lfs with largefiles -> normal
280 280 4 merge lfs with largefiles -> large
281 281 3 merge largefiles with lfs -> normal
282 282 2 merge largefiles with lfs -> large
283 283 1 large by size
284 284 0 remove large_by_size.bin
285 285 $ cd nolargefiles
286 286
287 287 The requirement is added to the destination repo, and the extension is enabled
288 288 locally.
289 289
290 290 $ cat .hg/requires
291 291 dotencode
292 292 fncache
293 293 generaldelta
294 294 lfs
295 295 revlogv1
296 296 store
297 297 $ hg config --debug extensions | grep lfs
298 298 $TESTTMP/nolargefiles/.hg/hgrc:*: extensions.lfs= (glob)
299 299
300 300 $ hg log -r 'all()' -G -T '{rev} {join(lfs_files, ", ")} ({desc})\n'
301 301 o 8 large_by_size.bin (remove large_by_size.bin)
302 302 |
303 303 o 7 large_by_size.bin (large by size)
304 304 |
305 305 o 6 (merge largefiles with lfs -> large)
306 306 |\
307 307 +---o 5 (merge largefiles with lfs -> normal)
308 308 | |/
309 309 +---o 4 lfs.bin (merge lfs with largefiles -> large)
310 310 | |/
311 311 +---o 3 (merge lfs with largefiles -> normal)
312 312 | |/
313 313 | o 2 lfs.bin (add with lfs extension)
314 314 | |
315 315 o | 1 lfs.bin (add largefiles)
316 316 |/
317 317 o 0 lfs.txt (normal.txt)
318 318
319 319 $ hg debugdata lfs.bin 0
320 320 version https://git-lfs.github.com/spec/v1
321 321 oid sha256:2172a5bd492dd41ec533b9bb695f7691b6351719407ac797f0ccad5348c81e62
322 322 size 53
323 323 x-is-binary 0
324 324 $ hg debugdata lfs.bin 1
325 325 version https://git-lfs.github.com/spec/v1
326 326 oid sha256:81c7492b2c05e130431f65a87651b54a30c5da72c99ce35a1e9b9872a807312b
327 327 size 53
328 328 x-is-binary 0
329 329 $ hg debugdata lfs.bin 2
330 330 version https://git-lfs.github.com/spec/v1
331 331 oid sha256:2172a5bd492dd41ec533b9bb695f7691b6351719407ac797f0ccad5348c81e62
332 332 size 53
333 333 x-is-binary 0
334 334 $ hg debugdata lfs.bin 3
335 335 abort: invalid revision identifier 3
336 336 [255]
337 337
338 338 No diffs when comparing merge and p1 that kept p1's changes. Diff of lfs to
339 339 largefiles no longer operates in standin files.
340 340
341 $ hg diff -r 2:3
341 This `head -n 20` looks dumb (since we expect no output), but if something
342 breaks you can get 1048576 lines of +y in the output, which takes a looooooong
343 time to print.
344 $ hg diff -r 2:3 | head -n 20
342 345 $ hg diff -r 2:6
343 346 diff -r e989d0fa3764 -r 752e3a0d8488 large.bin
344 347 --- a/large.bin Thu Jan 01 00:00:00 1970 +0000
345 348 +++ b/large.bin Thu Jan 01 00:00:00 1970 +0000
346 349 @@ -1,1 +1,1 @@
347 350 -below lfs threshold
348 351 +largefile
349 352 diff -r e989d0fa3764 -r 752e3a0d8488 lfs.bin
350 353 --- a/lfs.bin Thu Jan 01 00:00:00 1970 +0000
351 354 +++ b/lfs.bin Thu Jan 01 00:00:00 1970 +0000
352 355 @@ -1,1 +1,1 @@
353 356 -lfs above the lfs threshold for length 0000000000000
354 357 +largefile above lfs threshold 0000000000000000000000
General Comments 0
You need to be logged in to leave comments. Login now