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