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