Show More
@@ -1,666 +1,666 b'' | |||
|
1 | 1 | #testcases lfsremote-on lfsremote-off |
|
2 | 2 | #require serve no-reposimplestore no-chg |
|
3 | 3 | |
|
4 | 4 | This test splits `hg serve` with and without using the extension into separate |
|
5 | 5 | tests cases. The tests are broken down as follows, where "LFS"/"No-LFS" |
|
6 | 6 | indicates whether or not there are commits that use an LFS file, and "D"/"E" |
|
7 | 7 | indicates whether or not the extension is loaded. The "X" cases are not tested |
|
8 | 8 | individually, because the lfs requirement causes the process to bail early if |
|
9 | 9 | the extension is disabled. |
|
10 | 10 | |
|
11 | 11 | . Server |
|
12 | 12 | . |
|
13 | 13 | . No-LFS LFS |
|
14 | 14 | . +----------------------------+ |
|
15 | 15 | . | || D | E | D | E | |
|
16 | 16 | . |---++=======================| |
|
17 | 17 | . C | D || N/A | #1 | X | #4 | |
|
18 | 18 | . l No +---++-----------------------| |
|
19 | 19 | . i LFS | E || #2 | #2 | X | #5 | |
|
20 | 20 | . e +---++-----------------------| |
|
21 | 21 | . n | D || X | X | X | X | |
|
22 | 22 | . t LFS |---++-----------------------| |
|
23 | 23 | . | E || #3 | #3 | X | #6 | |
|
24 | 24 | . |---++-----------------------+ |
|
25 | 25 | |
|
26 | 26 | make command server magic visible |
|
27 | 27 | |
|
28 | 28 | #if windows |
|
29 | 29 | $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH" |
|
30 | 30 | #else |
|
31 | 31 | $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH" |
|
32 | 32 | #endif |
|
33 | 33 | $ export PYTHONPATH |
|
34 | 34 | |
|
35 | 35 | $ hg init server |
|
36 | 36 | $ SERVER_REQUIRES="$TESTTMP/server/.hg/requires" |
|
37 | 37 | |
|
38 | 38 | $ cat > $TESTTMP/debugprocessors.py <<EOF |
|
39 | 39 | > from mercurial import ( |
|
40 | 40 | > cmdutil, |
|
41 | 41 | > commands, |
|
42 | 42 | > pycompat, |
|
43 | 43 | > registrar, |
|
44 | 44 | > ) |
|
45 | 45 | > cmdtable = {} |
|
46 | 46 | > command = registrar.command(cmdtable) |
|
47 | 47 | > @command(b'debugprocessors', [], b'FILE') |
|
48 | 48 | > def debugprocessors(ui, repo, file_=None, **opts): |
|
49 | 49 | > opts = pycompat.byteskwargs(opts) |
|
50 | 50 | > opts[b'changelog'] = False |
|
51 | 51 | > opts[b'manifest'] = False |
|
52 | 52 | > opts[b'dir'] = False |
|
53 | 53 | > rl = cmdutil.openrevlog(repo, b'debugprocessors', file_, opts) |
|
54 |
> for flag, proc in rl._flagprocessors. |
|
|
54 | > for flag, proc in rl._flagprocessors.items(): | |
|
55 | 55 | > ui.status(b"registered processor '%#x'\n" % (flag)) |
|
56 | 56 | > EOF |
|
57 | 57 | |
|
58 | 58 | Skip the experimental.changegroup3=True config. Failure to agree on this comes |
|
59 | 59 | first, and causes a "ValueError: no common changegroup version" or "abort: |
|
60 | 60 | HTTP Error 500: Internal Server Error", if the extension is only loaded on one |
|
61 | 61 | side. If that *is* enabled, the subsequent failure is "abort: missing processor |
|
62 | 62 | for flag '0x2000'!" if the extension is only loaded on one side (possibly also |
|
63 | 63 | masked by the Internal Server Error message). |
|
64 | 64 | $ cat >> $HGRCPATH <<EOF |
|
65 | 65 | > [extensions] |
|
66 | 66 | > debugprocessors = $TESTTMP/debugprocessors.py |
|
67 | 67 | > [experimental] |
|
68 | 68 | > lfs.disableusercache = True |
|
69 | 69 | > [lfs] |
|
70 | 70 | > threshold=10 |
|
71 | 71 | > [web] |
|
72 | 72 | > allow_push=* |
|
73 | 73 | > push_ssl=False |
|
74 | 74 | > EOF |
|
75 | 75 | |
|
76 | 76 | $ cp $HGRCPATH $HGRCPATH.orig |
|
77 | 77 | |
|
78 | 78 | #if lfsremote-on |
|
79 | 79 | $ hg --config extensions.lfs= -R server \ |
|
80 | 80 | > serve -p $HGPORT -d --pid-file=hg.pid --errorlog=$TESTTMP/errors.log |
|
81 | 81 | #else |
|
82 | 82 | $ hg --config extensions.lfs=! -R server \ |
|
83 | 83 | > serve -p $HGPORT -d --pid-file=hg.pid --errorlog=$TESTTMP/errors.log |
|
84 | 84 | #endif |
|
85 | 85 | |
|
86 | 86 | $ cat hg.pid >> $DAEMON_PIDS |
|
87 | 87 | $ hg clone -q http://localhost:$HGPORT client |
|
88 | 88 | $ grep 'lfs' client/.hg/requires $SERVER_REQUIRES |
|
89 | 89 | [1] |
|
90 | 90 | |
|
91 | 91 | This trivial repo will force commandserver to load the extension, but not call |
|
92 | 92 | reposetup() on another repo actually being operated on. This gives coverage |
|
93 | 93 | that wrapper functions are not assuming reposetup() was called. |
|
94 | 94 | |
|
95 | 95 | $ hg init $TESTTMP/cmdservelfs |
|
96 | 96 | $ cat >> $TESTTMP/cmdservelfs/.hg/hgrc << EOF |
|
97 | 97 | > [extensions] |
|
98 | 98 | > lfs = |
|
99 | 99 | > EOF |
|
100 | 100 | |
|
101 | 101 | -------------------------------------------------------------------------------- |
|
102 | 102 | Case #1: client with non-lfs content and the extension disabled; server with |
|
103 | 103 | non-lfs content, and the extension enabled. |
|
104 | 104 | |
|
105 | 105 | $ cd client |
|
106 | 106 | $ echo 'non-lfs' > nonlfs.txt |
|
107 | 107 | >>> from __future__ import absolute_import |
|
108 | 108 | >>> from hgclient import check, readchannel, runcommand |
|
109 | 109 | >>> @check |
|
110 | 110 | ... def diff(server): |
|
111 | 111 | ... readchannel(server) |
|
112 | 112 | ... # run an arbitrary command in the repo with the extension loaded |
|
113 | 113 | ... runcommand(server, [b'id', b'-R', b'../cmdservelfs']) |
|
114 | 114 | ... # now run a command in a repo without the extension to ensure that |
|
115 | 115 | ... # files are added safely.. |
|
116 | 116 | ... runcommand(server, [b'ci', b'-Aqm', b'non-lfs']) |
|
117 | 117 | ... # .. and that scmutil.prefetchfiles() safely no-ops.. |
|
118 | 118 | ... runcommand(server, [b'diff', b'-r', b'.~1']) |
|
119 | 119 | ... # .. and that debugupgraderepo safely no-ops. |
|
120 | 120 | ... runcommand(server, [b'debugupgraderepo', b'-q', b'--run']) |
|
121 | 121 | *** runcommand id -R ../cmdservelfs |
|
122 | 122 | 000000000000 tip |
|
123 | 123 | *** runcommand ci -Aqm non-lfs |
|
124 | 124 | *** runcommand diff -r .~1 |
|
125 | 125 | diff -r 000000000000 nonlfs.txt |
|
126 | 126 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
127 | 127 | +++ b/nonlfs.txt Thu Jan 01 00:00:00 1970 +0000 |
|
128 | 128 | @@ -0,0 +1,1 @@ |
|
129 | 129 | +non-lfs |
|
130 | 130 | *** runcommand debugupgraderepo -q --run |
|
131 | 131 | upgrade will perform the following actions: |
|
132 | 132 | |
|
133 | 133 | requirements |
|
134 | 134 | preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store |
|
135 | 135 | |
|
136 | 136 | beginning upgrade... |
|
137 | 137 | repository locked and read-only |
|
138 | 138 | creating temporary repository to stage migrated data: * (glob) |
|
139 | 139 | (it is safe to interrupt this process any time before data migration completes) |
|
140 | 140 | migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog) |
|
141 | 141 | migrating 324 bytes in store; 129 bytes tracked data |
|
142 | 142 | migrating 1 filelogs containing 1 revisions (73 bytes in store; 8 bytes tracked data) |
|
143 | 143 | finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes |
|
144 | 144 | migrating 1 manifests containing 1 revisions (117 bytes in store; 52 bytes tracked data) |
|
145 | 145 | finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes |
|
146 | 146 | migrating changelog containing 1 revisions (134 bytes in store; 69 bytes tracked data) |
|
147 | 147 | finished migrating 1 changelog revisions; change in size: 0 bytes |
|
148 | 148 | finished migrating 3 total revisions; total change in store size: 0 bytes |
|
149 | 149 | copying phaseroots |
|
150 | 150 | data fully migrated to temporary repository |
|
151 | 151 | marking source repository as being upgraded; clients will be unable to read from repository |
|
152 | 152 | starting in-place swap of repository data |
|
153 | 153 | replaced files will be backed up at * (glob) |
|
154 | 154 | replacing store... |
|
155 | 155 | store replacement complete; repository was inconsistent for *s (glob) |
|
156 | 156 | finalizing requirements file and making repository readable again |
|
157 | 157 | removing temporary repository * (glob) |
|
158 | 158 | copy of old repository backed up at * (glob) |
|
159 | 159 | the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified |
|
160 | 160 | |
|
161 | 161 | $ grep 'lfs' .hg/requires $SERVER_REQUIRES |
|
162 | 162 | [1] |
|
163 | 163 | |
|
164 | 164 | #if lfsremote-on |
|
165 | 165 | |
|
166 | 166 | $ hg push -q |
|
167 | 167 | $ grep 'lfs' .hg/requires $SERVER_REQUIRES |
|
168 | 168 | [1] |
|
169 | 169 | |
|
170 | 170 | $ hg clone -q http://localhost:$HGPORT $TESTTMP/client1_clone |
|
171 | 171 | $ grep 'lfs' $TESTTMP/client1_clone/.hg/requires $SERVER_REQUIRES |
|
172 | 172 | [1] |
|
173 | 173 | |
|
174 | 174 | $ hg init $TESTTMP/client1_pull |
|
175 | 175 | $ hg -R $TESTTMP/client1_pull pull -q http://localhost:$HGPORT |
|
176 | 176 | $ grep 'lfs' $TESTTMP/client1_pull/.hg/requires $SERVER_REQUIRES |
|
177 | 177 | [1] |
|
178 | 178 | |
|
179 | 179 | $ hg identify http://localhost:$HGPORT |
|
180 | 180 | d437e1d24fbd |
|
181 | 181 | |
|
182 | 182 | #endif |
|
183 | 183 | |
|
184 | 184 | -------------------------------------------------------------------------------- |
|
185 | 185 | Case #2: client with non-lfs content and the extension enabled; server with |
|
186 | 186 | non-lfs content, and the extension state controlled by #testcases. |
|
187 | 187 | |
|
188 | 188 | $ cat >> $HGRCPATH <<EOF |
|
189 | 189 | > [extensions] |
|
190 | 190 | > lfs = |
|
191 | 191 | > EOF |
|
192 | 192 | $ echo 'non-lfs' > nonlfs2.txt |
|
193 | 193 | $ hg ci -Aqm 'non-lfs file with lfs client' |
|
194 | 194 | |
|
195 | 195 | Since no lfs content has been added yet, the push is allowed, even when the |
|
196 | 196 | extension is not enabled remotely. |
|
197 | 197 | |
|
198 | 198 | $ hg push -q |
|
199 | 199 | $ grep 'lfs' .hg/requires $SERVER_REQUIRES |
|
200 | 200 | [1] |
|
201 | 201 | |
|
202 | 202 | $ hg clone -q http://localhost:$HGPORT $TESTTMP/client2_clone |
|
203 | 203 | $ grep 'lfs' $TESTTMP/client2_clone/.hg/requires $SERVER_REQUIRES |
|
204 | 204 | [1] |
|
205 | 205 | |
|
206 | 206 | $ hg init $TESTTMP/client2_pull |
|
207 | 207 | $ hg -R $TESTTMP/client2_pull pull -q http://localhost:$HGPORT |
|
208 | 208 | $ grep 'lfs' $TESTTMP/client2_pull/.hg/requires $SERVER_REQUIRES |
|
209 | 209 | [1] |
|
210 | 210 | |
|
211 | 211 | $ hg identify http://localhost:$HGPORT |
|
212 | 212 | 1477875038c6 |
|
213 | 213 | |
|
214 | 214 | -------------------------------------------------------------------------------- |
|
215 | 215 | Case #3: client with lfs content and the extension enabled; server with |
|
216 | 216 | non-lfs content, and the extension state controlled by #testcases. The server |
|
217 | 217 | should have an 'lfs' requirement after it picks up its first commit with a blob. |
|
218 | 218 | |
|
219 | 219 | $ echo 'this is a big lfs file' > lfs.bin |
|
220 | 220 | $ hg ci -Aqm 'lfs' |
|
221 | 221 | $ grep 'lfs' .hg/requires $SERVER_REQUIRES |
|
222 | 222 | .hg/requires:lfs |
|
223 | 223 | |
|
224 | 224 | #if lfsremote-off |
|
225 | 225 | $ hg push -q |
|
226 | 226 | abort: required features are not supported in the destination: lfs |
|
227 | 227 | (enable the lfs extension on the server) |
|
228 | 228 | [255] |
|
229 | 229 | #else |
|
230 | 230 | $ hg push -q |
|
231 | 231 | #endif |
|
232 | 232 | $ grep 'lfs' .hg/requires $SERVER_REQUIRES |
|
233 | 233 | .hg/requires:lfs |
|
234 | 234 | $TESTTMP/server/.hg/requires:lfs (lfsremote-on !) |
|
235 | 235 | |
|
236 | 236 | $ hg clone -q http://localhost:$HGPORT $TESTTMP/client3_clone |
|
237 | 237 | $ grep 'lfs' $TESTTMP/client3_clone/.hg/requires $SERVER_REQUIRES || true |
|
238 | 238 | $TESTTMP/client3_clone/.hg/requires:lfs (lfsremote-on !) |
|
239 | 239 | $TESTTMP/server/.hg/requires:lfs (lfsremote-on !) |
|
240 | 240 | |
|
241 | 241 | $ hg init $TESTTMP/client3_pull |
|
242 | 242 | $ hg -R $TESTTMP/client3_pull pull -q http://localhost:$HGPORT |
|
243 | 243 | $ grep 'lfs' $TESTTMP/client3_pull/.hg/requires $SERVER_REQUIRES || true |
|
244 | 244 | $TESTTMP/client3_pull/.hg/requires:lfs (lfsremote-on !) |
|
245 | 245 | $TESTTMP/server/.hg/requires:lfs (lfsremote-on !) |
|
246 | 246 | |
|
247 | 247 | Test that the commit/changegroup requirement check hook can be run multiple |
|
248 | 248 | times. |
|
249 | 249 | |
|
250 | 250 | $ hg clone -qr 0 http://localhost:$HGPORT $TESTTMP/cmdserve_client3 |
|
251 | 251 | |
|
252 | 252 | $ cd ../cmdserve_client3 |
|
253 | 253 | |
|
254 | 254 | >>> from __future__ import absolute_import |
|
255 | 255 | >>> from hgclient import check, readchannel, runcommand |
|
256 | 256 | >>> @check |
|
257 | 257 | ... def addrequirement(server): |
|
258 | 258 | ... readchannel(server) |
|
259 | 259 | ... # change the repo in a way that adds the lfs requirement |
|
260 | 260 | ... runcommand(server, [b'pull', b'-qu']) |
|
261 | 261 | ... # Now cause the requirement adding hook to fire again, without going |
|
262 | 262 | ... # through reposetup() again. |
|
263 | 263 | ... with open('file.txt', 'wb') as fp: |
|
264 | 264 | ... fp.write(b'data') |
|
265 | 265 | ... runcommand(server, [b'ci', b'-Aqm', b'non-lfs']) |
|
266 | 266 | *** runcommand pull -qu |
|
267 | 267 | *** runcommand ci -Aqm non-lfs |
|
268 | 268 | |
|
269 | 269 | $ cd ../client |
|
270 | 270 | |
|
271 | 271 | The difference here is the push failed above when the extension isn't |
|
272 | 272 | enabled on the server. |
|
273 | 273 | $ hg identify http://localhost:$HGPORT |
|
274 | 274 | 8374dc4052cb (lfsremote-on !) |
|
275 | 275 | 1477875038c6 (lfsremote-off !) |
|
276 | 276 | |
|
277 | 277 | Don't bother testing the lfsremote-off cases- the server won't be able |
|
278 | 278 | to launch if there's lfs content and the extension is disabled. |
|
279 | 279 | |
|
280 | 280 | #if lfsremote-on |
|
281 | 281 | |
|
282 | 282 | -------------------------------------------------------------------------------- |
|
283 | 283 | Case #4: client with non-lfs content and the extension disabled; server with |
|
284 | 284 | lfs content, and the extension enabled. |
|
285 | 285 | |
|
286 | 286 | $ cat >> $HGRCPATH <<EOF |
|
287 | 287 | > [extensions] |
|
288 | 288 | > lfs = ! |
|
289 | 289 | > EOF |
|
290 | 290 | |
|
291 | 291 | $ hg init $TESTTMP/client4 |
|
292 | 292 | $ cd $TESTTMP/client4 |
|
293 | 293 | $ cat >> .hg/hgrc <<EOF |
|
294 | 294 | > [paths] |
|
295 | 295 | > default = http://localhost:$HGPORT |
|
296 | 296 | > EOF |
|
297 | 297 | $ echo 'non-lfs' > nonlfs2.txt |
|
298 | 298 | $ hg ci -Aqm 'non-lfs' |
|
299 | 299 | $ grep 'lfs' .hg/requires $SERVER_REQUIRES |
|
300 | 300 | $TESTTMP/server/.hg/requires:lfs |
|
301 | 301 | |
|
302 | 302 | $ hg push -q --force |
|
303 | 303 | warning: repository is unrelated |
|
304 | 304 | $ grep 'lfs' .hg/requires $SERVER_REQUIRES |
|
305 | 305 | $TESTTMP/server/.hg/requires:lfs |
|
306 | 306 | |
|
307 | 307 | $ hg clone http://localhost:$HGPORT $TESTTMP/client4_clone |
|
308 | 308 | (remote is using large file support (lfs), but it is explicitly disabled in the local configuration) |
|
309 | 309 | abort: repository requires features unknown to this Mercurial: lfs! |
|
310 | 310 | (see https://mercurial-scm.org/wiki/MissingRequirement for more information) |
|
311 | 311 | [255] |
|
312 | 312 | $ grep 'lfs' $TESTTMP/client4_clone/.hg/requires $SERVER_REQUIRES |
|
313 | 313 | grep: $TESTTMP/client4_clone/.hg/requires: $ENOENT$ |
|
314 | 314 | $TESTTMP/server/.hg/requires:lfs |
|
315 | 315 | [2] |
|
316 | 316 | |
|
317 | 317 | TODO: fail more gracefully. |
|
318 | 318 | |
|
319 | 319 | $ hg init $TESTTMP/client4_pull |
|
320 | 320 | $ hg -R $TESTTMP/client4_pull pull -q http://localhost:$HGPORT |
|
321 | 321 | abort: HTTP Error 500: Internal Server Error |
|
322 | 322 | [255] |
|
323 | 323 | $ grep 'lfs' $TESTTMP/client4_pull/.hg/requires $SERVER_REQUIRES |
|
324 | 324 | $TESTTMP/server/.hg/requires:lfs |
|
325 | 325 | |
|
326 | 326 | $ hg identify http://localhost:$HGPORT |
|
327 | 327 | 03b080fa9d93 |
|
328 | 328 | |
|
329 | 329 | -------------------------------------------------------------------------------- |
|
330 | 330 | Case #5: client with non-lfs content and the extension enabled; server with |
|
331 | 331 | lfs content, and the extension enabled. |
|
332 | 332 | |
|
333 | 333 | $ cat >> $HGRCPATH <<EOF |
|
334 | 334 | > [extensions] |
|
335 | 335 | > lfs = |
|
336 | 336 | > EOF |
|
337 | 337 | $ echo 'non-lfs' > nonlfs3.txt |
|
338 | 338 | $ hg ci -Aqm 'non-lfs file with lfs client' |
|
339 | 339 | |
|
340 | 340 | $ hg push -q |
|
341 | 341 | $ grep 'lfs' .hg/requires $SERVER_REQUIRES |
|
342 | 342 | $TESTTMP/server/.hg/requires:lfs |
|
343 | 343 | |
|
344 | 344 | $ hg clone -q http://localhost:$HGPORT $TESTTMP/client5_clone |
|
345 | 345 | $ grep 'lfs' $TESTTMP/client5_clone/.hg/requires $SERVER_REQUIRES |
|
346 | 346 | $TESTTMP/client5_clone/.hg/requires:lfs |
|
347 | 347 | $TESTTMP/server/.hg/requires:lfs |
|
348 | 348 | |
|
349 | 349 | $ hg init $TESTTMP/client5_pull |
|
350 | 350 | $ hg -R $TESTTMP/client5_pull pull -q http://localhost:$HGPORT |
|
351 | 351 | $ grep 'lfs' $TESTTMP/client5_pull/.hg/requires $SERVER_REQUIRES |
|
352 | 352 | $TESTTMP/client5_pull/.hg/requires:lfs |
|
353 | 353 | $TESTTMP/server/.hg/requires:lfs |
|
354 | 354 | |
|
355 | 355 | $ hg identify http://localhost:$HGPORT |
|
356 | 356 | c729025cc5e3 |
|
357 | 357 | |
|
358 | 358 | $ mv $HGRCPATH $HGRCPATH.tmp |
|
359 | 359 | $ cp $HGRCPATH.orig $HGRCPATH |
|
360 | 360 | |
|
361 | 361 | >>> from __future__ import absolute_import |
|
362 | 362 | >>> from hgclient import check, readchannel, runcommand |
|
363 | 363 | >>> @check |
|
364 | 364 | ... def checkflags(server): |
|
365 | 365 | ... readchannel(server) |
|
366 | 366 | ... print('') |
|
367 | 367 | ... print('# LFS required- both lfs and non-lfs revlogs have 0x2000 flag') |
|
368 | 368 | ... runcommand(server, [b'debugprocessors', b'lfs.bin', b'-R', |
|
369 | 369 | ... b'../server']) |
|
370 | 370 | ... runcommand(server, [b'debugprocessors', b'nonlfs2.txt', b'-R', |
|
371 | 371 | ... b'../server']) |
|
372 | 372 | ... runcommand(server, [b'config', b'extensions', b'--cwd', |
|
373 | 373 | ... b'../server']) |
|
374 | 374 | ... |
|
375 | 375 | ... print("\n# LFS not enabled- revlogs don't have 0x2000 flag") |
|
376 | 376 | ... runcommand(server, [b'debugprocessors', b'nonlfs3.txt']) |
|
377 | 377 | ... runcommand(server, [b'config', b'extensions']) |
|
378 | 378 | |
|
379 | 379 | # LFS required- both lfs and non-lfs revlogs have 0x2000 flag |
|
380 | 380 | *** runcommand debugprocessors lfs.bin -R ../server |
|
381 | 381 | registered processor '0x8000' |
|
382 | 382 | registered processor '0x2000' |
|
383 | 383 | *** runcommand debugprocessors nonlfs2.txt -R ../server |
|
384 | 384 | registered processor '0x8000' |
|
385 | 385 | registered processor '0x2000' |
|
386 | 386 | *** runcommand config extensions --cwd ../server |
|
387 | 387 | extensions.debugprocessors=$TESTTMP/debugprocessors.py |
|
388 | 388 | extensions.lfs= |
|
389 | 389 | |
|
390 | 390 | # LFS not enabled- revlogs don't have 0x2000 flag |
|
391 | 391 | *** runcommand debugprocessors nonlfs3.txt |
|
392 | 392 | registered processor '0x8000' |
|
393 | 393 | *** runcommand config extensions |
|
394 | 394 | extensions.debugprocessors=$TESTTMP/debugprocessors.py |
|
395 | 395 | |
|
396 | 396 | $ rm $HGRCPATH |
|
397 | 397 | $ mv $HGRCPATH.tmp $HGRCPATH |
|
398 | 398 | |
|
399 | 399 | $ hg clone $TESTTMP/client $TESTTMP/nonlfs -qr 0 --config extensions.lfs= |
|
400 | 400 | $ cat >> $TESTTMP/nonlfs/.hg/hgrc <<EOF |
|
401 | 401 | > [extensions] |
|
402 | 402 | > lfs = ! |
|
403 | 403 | > EOF |
|
404 | 404 | |
|
405 | 405 | >>> from __future__ import absolute_import, print_function |
|
406 | 406 | >>> from hgclient import check, readchannel, runcommand |
|
407 | 407 | >>> @check |
|
408 | 408 | ... def checkflags2(server): |
|
409 | 409 | ... readchannel(server) |
|
410 | 410 | ... print('') |
|
411 | 411 | ... print('# LFS enabled- both lfs and non-lfs revlogs have 0x2000 flag') |
|
412 | 412 | ... runcommand(server, [b'debugprocessors', b'lfs.bin', b'-R', |
|
413 | 413 | ... b'../server']) |
|
414 | 414 | ... runcommand(server, [b'debugprocessors', b'nonlfs2.txt', b'-R', |
|
415 | 415 | ... b'../server']) |
|
416 | 416 | ... runcommand(server, [b'config', b'extensions', b'--cwd', |
|
417 | 417 | ... b'../server']) |
|
418 | 418 | ... |
|
419 | 419 | ... print('\n# LFS enabled without requirement- revlogs have 0x2000 flag') |
|
420 | 420 | ... runcommand(server, [b'debugprocessors', b'nonlfs3.txt']) |
|
421 | 421 | ... runcommand(server, [b'config', b'extensions']) |
|
422 | 422 | ... |
|
423 | 423 | ... print("\n# LFS disabled locally- revlogs don't have 0x2000 flag") |
|
424 | 424 | ... runcommand(server, ['debugprocessors', 'nonlfs.txt', '-R', |
|
425 | 425 | ... '../nonlfs']) |
|
426 | 426 | ... runcommand(server, ['config', 'extensions', '--cwd', |
|
427 | 427 | ... '../nonlfs']) |
|
428 | 428 | |
|
429 | 429 | # LFS enabled- both lfs and non-lfs revlogs have 0x2000 flag |
|
430 | 430 | *** runcommand debugprocessors lfs.bin -R ../server |
|
431 | 431 | registered processor '0x8000' |
|
432 | 432 | registered processor '0x2000' |
|
433 | 433 | *** runcommand debugprocessors nonlfs2.txt -R ../server |
|
434 | 434 | registered processor '0x8000' |
|
435 | 435 | registered processor '0x2000' |
|
436 | 436 | *** runcommand config extensions --cwd ../server |
|
437 | 437 | extensions.debugprocessors=$TESTTMP/debugprocessors.py |
|
438 | 438 | extensions.lfs= |
|
439 | 439 | |
|
440 | 440 | # LFS enabled without requirement- revlogs have 0x2000 flag |
|
441 | 441 | *** runcommand debugprocessors nonlfs3.txt |
|
442 | 442 | registered processor '0x8000' |
|
443 | 443 | registered processor '0x2000' |
|
444 | 444 | *** runcommand config extensions |
|
445 | 445 | extensions.debugprocessors=$TESTTMP/debugprocessors.py |
|
446 | 446 | extensions.lfs= |
|
447 | 447 | |
|
448 | 448 | # LFS disabled locally- revlogs don't have 0x2000 flag |
|
449 | 449 | *** runcommand debugprocessors nonlfs.txt -R ../nonlfs |
|
450 | 450 | registered processor '0x8000' |
|
451 | 451 | *** runcommand config extensions --cwd ../nonlfs |
|
452 | 452 | extensions.debugprocessors=$TESTTMP/debugprocessors.py |
|
453 | 453 | extensions.lfs=! |
|
454 | 454 | |
|
455 | 455 | -------------------------------------------------------------------------------- |
|
456 | 456 | Case #6: client with lfs content and the extension enabled; server with |
|
457 | 457 | lfs content, and the extension enabled. |
|
458 | 458 | |
|
459 | 459 | $ echo 'this is another lfs file' > lfs2.txt |
|
460 | 460 | $ hg ci -Aqm 'lfs file with lfs client' |
|
461 | 461 | |
|
462 | 462 | $ hg --config paths.default= push -v http://localhost:$HGPORT |
|
463 | 463 | pushing to http://localhost:$HGPORT/ |
|
464 | 464 | lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs |
|
465 | 465 | searching for changes |
|
466 | 466 | remote has heads on branch 'default' that are not known locally: 8374dc4052cb |
|
467 | 467 | lfs: uploading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes) |
|
468 | 468 | lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de |
|
469 | 469 | lfs: uploaded 1 files (25 bytes) |
|
470 | 470 | 1 changesets found |
|
471 | 471 | uncompressed size of bundle content: |
|
472 | 472 | 206 (changelog) |
|
473 | 473 | 172 (manifests) |
|
474 | 474 | 275 lfs2.txt |
|
475 | 475 | remote: adding changesets |
|
476 | 476 | remote: adding manifests |
|
477 | 477 | remote: adding file changes |
|
478 | 478 | remote: added 1 changesets with 1 changes to 1 files |
|
479 | 479 | $ grep 'lfs' .hg/requires $SERVER_REQUIRES |
|
480 | 480 | .hg/requires:lfs |
|
481 | 481 | $TESTTMP/server/.hg/requires:lfs |
|
482 | 482 | |
|
483 | 483 | $ hg clone -q http://localhost:$HGPORT $TESTTMP/client6_clone |
|
484 | 484 | $ grep 'lfs' $TESTTMP/client6_clone/.hg/requires $SERVER_REQUIRES |
|
485 | 485 | $TESTTMP/client6_clone/.hg/requires:lfs |
|
486 | 486 | $TESTTMP/server/.hg/requires:lfs |
|
487 | 487 | |
|
488 | 488 | $ hg init $TESTTMP/client6_pull |
|
489 | 489 | $ hg -R $TESTTMP/client6_pull pull -u -v http://localhost:$HGPORT |
|
490 | 490 | pulling from http://localhost:$HGPORT/ |
|
491 | 491 | requesting all changes |
|
492 | 492 | adding changesets |
|
493 | 493 | adding manifests |
|
494 | 494 | adding file changes |
|
495 | 495 | added 6 changesets with 5 changes to 5 files (+1 heads) |
|
496 | 496 | calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs |
|
497 | 497 | new changesets d437e1d24fbd:d3b84d50eacb |
|
498 | 498 | resolving manifests |
|
499 | 499 | lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs |
|
500 | 500 | lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes) |
|
501 | 501 | lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de |
|
502 | 502 | lfs: downloaded 1 files (25 bytes) |
|
503 | 503 | getting lfs2.txt |
|
504 | 504 | lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store |
|
505 | 505 | getting nonlfs2.txt |
|
506 | 506 | getting nonlfs3.txt |
|
507 | 507 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
508 | 508 | updated to "d3b84d50eacb: lfs file with lfs client" |
|
509 | 509 | 1 other heads for branch "default" |
|
510 | 510 | (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob) |
|
511 | 511 | $ grep 'lfs' $TESTTMP/client6_pull/.hg/requires $SERVER_REQUIRES |
|
512 | 512 | $TESTTMP/client6_pull/.hg/requires:lfs |
|
513 | 513 | $TESTTMP/server/.hg/requires:lfs |
|
514 | 514 | |
|
515 | 515 | $ hg identify http://localhost:$HGPORT |
|
516 | 516 | d3b84d50eacb |
|
517 | 517 | |
|
518 | 518 | -------------------------------------------------------------------------------- |
|
519 | 519 | Misc: process dies early if a requirement exists and the extension is disabled |
|
520 | 520 | |
|
521 | 521 | $ hg --config extensions.lfs=! summary |
|
522 | 522 | abort: repository requires features unknown to this Mercurial: lfs! |
|
523 | 523 | (see https://mercurial-scm.org/wiki/MissingRequirement for more information) |
|
524 | 524 | [255] |
|
525 | 525 | |
|
526 | 526 | $ echo 'this is an lfs file' > $TESTTMP/client6_clone/lfspair1.bin |
|
527 | 527 | $ echo 'this is an lfs file too' > $TESTTMP/client6_clone/lfspair2.bin |
|
528 | 528 | $ hg -R $TESTTMP/client6_clone ci -Aqm 'add lfs pair' |
|
529 | 529 | $ hg -R $TESTTMP/client6_clone push -q |
|
530 | 530 | |
|
531 | 531 | $ hg clone -qU http://localhost:$HGPORT $TESTTMP/bulkfetch |
|
532 | 532 | |
|
533 | 533 | Export will prefetch all needed files across all needed revisions |
|
534 | 534 | |
|
535 | 535 | $ hg -R $TESTTMP/bulkfetch -v export -r 0:tip -o all.export |
|
536 | 536 | lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs |
|
537 | 537 | exporting patches: |
|
538 | 538 | lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs |
|
539 | 539 | lfs: need to transfer 4 objects (92 bytes) |
|
540 | 540 | lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes) |
|
541 | 541 | lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de |
|
542 | 542 | lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes) |
|
543 | 543 | lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc |
|
544 | 544 | lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes) |
|
545 | 545 | lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 |
|
546 | 546 | lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes) |
|
547 | 547 | lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e |
|
548 | 548 | lfs: downloaded 4 files (92 bytes) |
|
549 | 549 | all.export |
|
550 | 550 | lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store |
|
551 | 551 | lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store |
|
552 | 552 | lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store |
|
553 | 553 | lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store |
|
554 | 554 | |
|
555 | 555 | Export with selected files is used with `extdiff --patch` |
|
556 | 556 | |
|
557 | 557 | $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs |
|
558 | 558 | $ hg --config extensions.extdiff= \ |
|
559 | 559 | > -R $TESTTMP/bulkfetch -v extdiff -r 2:tip --patch $TESTTMP/bulkfetch/lfs.bin |
|
560 | 560 | lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs |
|
561 | 561 | lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs |
|
562 | 562 | lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes) |
|
563 | 563 | lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc |
|
564 | 564 | lfs: downloaded 1 files (23 bytes) |
|
565 | 565 | */hg-8374dc4052cb.patch (glob) |
|
566 | 566 | lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store |
|
567 | 567 | */hg-9640b57e77b1.patch (glob) |
|
568 | 568 | --- */hg-8374dc4052cb.patch * (glob) |
|
569 | 569 | +++ */hg-9640b57e77b1.patch * (glob) |
|
570 | 570 | @@ -2,12 +2,7 @@ |
|
571 | 571 | # User test |
|
572 | 572 | # Date 0 0 |
|
573 | 573 | # Thu Jan 01 00:00:00 1970 +0000 |
|
574 | 574 | -# Node ID 8374dc4052cbd388e79d9dc4ddb29784097aa354 |
|
575 | 575 | -# Parent 1477875038c60152e391238920a16381c627b487 |
|
576 | 576 | -lfs |
|
577 | 577 | +# Node ID 9640b57e77b14c3a0144fb4478b6cc13e13ea0d1 |
|
578 | 578 | +# Parent d3b84d50eacbd56638e11abce6b8616aaba54420 |
|
579 | 579 | +add lfs pair |
|
580 | 580 | |
|
581 | 581 | -diff -r 1477875038c6 -r 8374dc4052cb lfs.bin |
|
582 | 582 | ---- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
583 | 583 | -+++ b/lfs.bin Thu Jan 01 00:00:00 1970 +0000 |
|
584 | 584 | -@@ -0,0 +1,1 @@ |
|
585 | 585 | -+this is a big lfs file |
|
586 | 586 | cleaning up temp directory |
|
587 | 587 | [1] |
|
588 | 588 | |
|
589 | 589 | Diff will prefetch files |
|
590 | 590 | |
|
591 | 591 | $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs |
|
592 | 592 | $ hg -R $TESTTMP/bulkfetch -v diff -r 2:tip |
|
593 | 593 | lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs |
|
594 | 594 | lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs |
|
595 | 595 | lfs: need to transfer 4 objects (92 bytes) |
|
596 | 596 | lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes) |
|
597 | 597 | lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de |
|
598 | 598 | lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes) |
|
599 | 599 | lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc |
|
600 | 600 | lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes) |
|
601 | 601 | lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 |
|
602 | 602 | lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes) |
|
603 | 603 | lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e |
|
604 | 604 | lfs: downloaded 4 files (92 bytes) |
|
605 | 605 | lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store |
|
606 | 606 | lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store |
|
607 | 607 | lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store |
|
608 | 608 | lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store |
|
609 | 609 | diff -r 8374dc4052cb -r 9640b57e77b1 lfs.bin |
|
610 | 610 | --- a/lfs.bin Thu Jan 01 00:00:00 1970 +0000 |
|
611 | 611 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
612 | 612 | @@ -1,1 +0,0 @@ |
|
613 | 613 | -this is a big lfs file |
|
614 | 614 | diff -r 8374dc4052cb -r 9640b57e77b1 lfs2.txt |
|
615 | 615 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
616 | 616 | +++ b/lfs2.txt Thu Jan 01 00:00:00 1970 +0000 |
|
617 | 617 | @@ -0,0 +1,1 @@ |
|
618 | 618 | +this is another lfs file |
|
619 | 619 | diff -r 8374dc4052cb -r 9640b57e77b1 lfspair1.bin |
|
620 | 620 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
621 | 621 | +++ b/lfspair1.bin Thu Jan 01 00:00:00 1970 +0000 |
|
622 | 622 | @@ -0,0 +1,1 @@ |
|
623 | 623 | +this is an lfs file |
|
624 | 624 | diff -r 8374dc4052cb -r 9640b57e77b1 lfspair2.bin |
|
625 | 625 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
626 | 626 | +++ b/lfspair2.bin Thu Jan 01 00:00:00 1970 +0000 |
|
627 | 627 | @@ -0,0 +1,1 @@ |
|
628 | 628 | +this is an lfs file too |
|
629 | 629 | diff -r 8374dc4052cb -r 9640b57e77b1 nonlfs.txt |
|
630 | 630 | --- a/nonlfs.txt Thu Jan 01 00:00:00 1970 +0000 |
|
631 | 631 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
632 | 632 | @@ -1,1 +0,0 @@ |
|
633 | 633 | -non-lfs |
|
634 | 634 | diff -r 8374dc4052cb -r 9640b57e77b1 nonlfs3.txt |
|
635 | 635 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
636 | 636 | +++ b/nonlfs3.txt Thu Jan 01 00:00:00 1970 +0000 |
|
637 | 637 | @@ -0,0 +1,1 @@ |
|
638 | 638 | +non-lfs |
|
639 | 639 | |
|
640 | 640 | Only the files required by diff are prefetched |
|
641 | 641 | |
|
642 | 642 | $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs |
|
643 | 643 | $ hg -R $TESTTMP/bulkfetch -v diff -r 2:tip $TESTTMP/bulkfetch/lfspair2.bin |
|
644 | 644 | lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs |
|
645 | 645 | lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs |
|
646 | 646 | lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes) |
|
647 | 647 | lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e |
|
648 | 648 | lfs: downloaded 1 files (24 bytes) |
|
649 | 649 | lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store |
|
650 | 650 | diff -r 8374dc4052cb -r 9640b57e77b1 lfspair2.bin |
|
651 | 651 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
652 | 652 | +++ b/lfspair2.bin Thu Jan 01 00:00:00 1970 +0000 |
|
653 | 653 | @@ -0,0 +1,1 @@ |
|
654 | 654 | +this is an lfs file too |
|
655 | 655 | |
|
656 | 656 | #endif |
|
657 | 657 | |
|
658 | 658 | $ "$PYTHON" $TESTDIR/killdaemons.py $DAEMON_PIDS |
|
659 | 659 | |
|
660 | 660 | #if lfsremote-on |
|
661 | 661 | $ cat $TESTTMP/errors.log | grep '^[A-Z]' |
|
662 | 662 | Traceback (most recent call last): |
|
663 | 663 | ValueError: no common changegroup version |
|
664 | 664 | #else |
|
665 | 665 | $ cat $TESTTMP/errors.log |
|
666 | 666 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now