| 1 |
#require serve no-chg |
| 2 |
|
| 3 |
#testcases stream-legacy stream-bundle2-v2 stream-bundle2-v3 |
| 4 |
#testcases fncache fileindex |
| 5 |
|
| 6 |
#if stream-legacy |
| 7 |
$ cat << EOF >> $HGRCPATH |
| 8 |
> [server] |
| 9 |
> bundle2.stream = no |
| 10 |
> [format] |
| 11 |
> # persistent nodemap is too broken with legacy format, |
| 12 |
> # however client with nodemap support will have better stream support. |
| 13 |
> use-persistent-nodemap=no |
| 14 |
> EOF |
| 15 |
#endif |
| 16 |
#if stream-bundle2-v3 |
| 17 |
$ cat << EOF >> $HGRCPATH |
| 18 |
> [experimental] |
| 19 |
> stream-v3 = yes |
| 20 |
> EOF |
| 21 |
#endif |
| 22 |
|
| 23 |
#if fileindex |
| 24 |
$ cat >> $HGRCPATH << EOF |
| 25 |
> [format] |
| 26 |
> use-fileindex-v1=yes |
| 27 |
> EOF |
| 28 |
#else |
| 29 |
$ cat >> $HGRCPATH << EOF |
| 30 |
> [format] |
| 31 |
> use-fileindex-v1=no |
| 32 |
> EOF |
| 33 |
#endif |
| 34 |
|
| 35 |
#if fileindex no-rust |
| 36 |
$ cat >> $HGRCPATH << EOF |
| 37 |
> [storage] |
| 38 |
> fileindex.slow-path=allow |
| 39 |
> EOF |
| 40 |
#endif |
| 41 |
|
| 42 |
Initialize repository |
| 43 |
|
| 44 |
$ hg init server |
| 45 |
$ cd server |
| 46 |
$ sh $TESTDIR/testlib/stream_clone_setup.sh |
| 47 |
adding 00changelog-ab349180a0405010.nd |
| 48 |
adding 00changelog.d |
| 49 |
adding 00changelog.i |
| 50 |
adding 00changelog.n |
| 51 |
adding 00manifest.d |
| 52 |
adding 00manifest.i |
| 53 |
adding container/isam-build-centos7/bazel-coverage-generator-sandboxfs-compatibility-0758e3e4f6057904d44399bd666faba9e7f40686.patch |
| 54 |
adding data/foo.d |
| 55 |
adding data/foo.i |
| 56 |
adding data/foo.n |
| 57 |
adding data/undo.babar |
| 58 |
adding data/undo.d |
| 59 |
adding data/undo.foo.d |
| 60 |
adding data/undo.foo.i |
| 61 |
adding data/undo.foo.n |
| 62 |
adding data/undo.i |
| 63 |
adding data/undo.n |
| 64 |
adding data/undo.py |
| 65 |
adding foo.d |
| 66 |
adding foo.i |
| 67 |
adding foo.n |
| 68 |
adding meta/foo.d |
| 69 |
adding meta/foo.i |
| 70 |
adding meta/foo.n |
| 71 |
adding meta/undo.babar |
| 72 |
adding meta/undo.d |
| 73 |
adding meta/undo.foo.d |
| 74 |
adding meta/undo.foo.i |
| 75 |
adding meta/undo.foo.n |
| 76 |
adding meta/undo.i |
| 77 |
adding meta/undo.n |
| 78 |
adding meta/undo.py |
| 79 |
adding savanah/foo.d |
| 80 |
adding savanah/foo.i |
| 81 |
adding savanah/foo.n |
| 82 |
adding savanah/undo.babar |
| 83 |
adding savanah/undo.d |
| 84 |
adding savanah/undo.foo.d |
| 85 |
adding savanah/undo.foo.i |
| 86 |
adding savanah/undo.foo.n |
| 87 |
adding savanah/undo.i |
| 88 |
adding savanah/undo.n |
| 89 |
adding savanah/undo.py |
| 90 |
adding store/C\xc3\xa9lesteVille_is_a_Capital_City (esc) |
| 91 |
adding store/foo.d |
| 92 |
adding store/foo.i |
| 93 |
adding store/foo.n |
| 94 |
adding store/undo.babar |
| 95 |
adding store/undo.d |
| 96 |
adding store/undo.foo.d |
| 97 |
adding store/undo.foo.i |
| 98 |
adding store/undo.foo.n |
| 99 |
adding store/undo.i |
| 100 |
adding store/undo.n |
| 101 |
adding store/undo.py |
| 102 |
adding undo.babar |
| 103 |
adding undo.d |
| 104 |
adding undo.foo.d |
| 105 |
adding undo.foo.i |
| 106 |
adding undo.foo.n |
| 107 |
adding undo.i |
| 108 |
adding undo.n |
| 109 |
adding undo.py |
| 110 |
|
| 111 |
$ hg --config server.uncompressed=false serve -p $HGPORT -d --pid-file=hg.pid |
| 112 |
$ cat hg.pid > $DAEMON_PIDS |
| 113 |
$ cd .. |
| 114 |
|
| 115 |
Check local clone |
| 116 |
================== |
| 117 |
|
| 118 |
The logic is close enough of uncompressed. |
| 119 |
This is present here to reuse the testing around file with "special" names. |
| 120 |
|
| 121 |
$ hg clone server local-clone |
| 122 |
updating to branch default |
| 123 |
1088 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 124 |
|
| 125 |
Check that the clone went well |
| 126 |
|
| 127 |
$ hg verify -R local-clone -q |
| 128 |
|
| 129 |
Check uncompressed |
| 130 |
================== |
| 131 |
|
| 132 |
Cannot stream clone when server.uncompressed is set to false |
| 133 |
------------------------------------------------------------ |
| 134 |
|
| 135 |
When `server.uncompressed` is disabled, the client should fallback to a bundle |
| 136 |
based clone with a warning. |
| 137 |
|
| 138 |
|
| 139 |
$ get-with-headers.py $LOCALIP:$HGPORT '?cmd=stream_out' |
| 140 |
200 Script output follows |
| 141 |
|
| 142 |
1 |
| 143 |
|
| 144 |
$ hg debugcapabilities http://localhost:$HGPORT |
| 145 |
Main capabilities: |
| 146 |
batch |
| 147 |
branchmap |
| 148 |
$USUAL_BUNDLE2_CAPS_SERVER$ |
| 149 |
changegroupsubset |
| 150 |
compression=$BUNDLE2_COMPRESSIONS$ |
| 151 |
getbundle |
| 152 |
httpheader=1024 |
| 153 |
httpmediatype=0.1rx,0.1tx,0.2tx |
| 154 |
known |
| 155 |
lookup |
| 156 |
pushkey |
| 157 |
unbundle=HG10GZ,HG10BZ,HG10UN |
| 158 |
unbundlehash |
| 159 |
Bundle2 capabilities: |
| 160 |
HG20 |
| 161 |
bookmarks |
| 162 |
changegroup |
| 163 |
01 |
| 164 |
02 |
| 165 |
03 |
| 166 |
checkheads |
| 167 |
related |
| 168 |
delta-compression |
| 169 |
none |
| 170 |
zlib |
| 171 |
zstd (zstd !) |
| 172 |
digests |
| 173 |
md5 |
| 174 |
sha1 |
| 175 |
sha512 |
| 176 |
error |
| 177 |
abort |
| 178 |
unsupportedcontent |
| 179 |
pushraced |
| 180 |
pushkey |
| 181 |
hgtagsfnodes |
| 182 |
listkeys |
| 183 |
phases |
| 184 |
heads |
| 185 |
pushkey |
| 186 |
remote-changegroup |
| 187 |
http |
| 188 |
https |
| 189 |
|
| 190 |
$ hg clone --stream -U http://localhost:$HGPORT server-disabled |
| 191 |
warning: stream clone requested but server has them disabled |
| 192 |
requesting all changes |
| 193 |
adding changesets |
| 194 |
adding manifests |
| 195 |
adding file changes |
| 196 |
added 3 changesets with 1088 changes to 1088 files |
| 197 |
new changesets 96ee1d7354c4:5223b5e3265f |
| 198 |
|
| 199 |
$ killdaemons.py |
| 200 |
$ cd server |
| 201 |
$ hg serve -p $HGPORT -d --pid-file=hg.pid --error errors.txt |
| 202 |
$ cat hg.pid > $DAEMON_PIDS |
| 203 |
$ cd .. |
| 204 |
|
| 205 |
Basic clone |
| 206 |
----------- |
| 207 |
|
| 208 |
Check that --stream trigger a stream clone and result in a valid repositoty |
| 209 |
|
| 210 |
We check the associated output for exact bytes on file number as changes in |
| 211 |
these value implies changes in the data transfered and can detect unintended |
| 212 |
changes in the process. |
| 213 |
|
| 214 |
#if stream-legacy |
| 215 |
$ hg clone --stream -U http://localhost:$HGPORT clone1 |
| 216 |
streaming all changes |
| 217 |
1091 files to transfer, 102 KB of data (no-zstd !) |
| 218 |
stream-cloned 1091 files / 102 KB in * seconds (* */sec) (glob) (no-zstd !) |
| 219 |
1091 files to transfer, 98.8 KB of data (zstd !) |
| 220 |
stream-cloned 1091 files / 98.8 KB in * seconds (* */sec) (glob) (zstd !) |
| 221 |
searching for changes |
| 222 |
no changes found |
| 223 |
#endif |
| 224 |
#if stream-bundle2-v2 |
| 225 |
$ hg clone --stream -U http://localhost:$HGPORT clone1 |
| 226 |
streaming all changes |
| 227 |
1094 files to transfer, 102 KB of data (no-zstd !) |
| 228 |
stream-cloned 1094 files / 102 KB in * seconds (* */sec) (glob) (no-zstd !) |
| 229 |
1094 files to transfer, 98.9 KB of data (zstd no-rust !) |
| 230 |
stream-cloned 1094 files / 98.9 KB in * seconds (* */sec) (glob) (zstd no-rust !) |
| 231 |
1096 files to transfer, 99.0 KB of data (zstd rust !) |
| 232 |
stream-cloned 1096 files / 99.0 KB in * seconds (* */sec) (glob) (zstd rust !) |
| 233 |
#endif |
| 234 |
|
| 235 |
#if stream-bundle2-v3 |
| 236 |
$ hg clone --stream -U http://localhost:$HGPORT clone1 |
| 237 |
streaming all changes |
| 238 |
1093 entries to transfer |
| 239 |
stream-cloned 1094 files / 102 KB in * seconds (* */sec) (glob) (no-zstd !) |
| 240 |
stream-cloned 1094 files / 98.9 KB in * seconds (* */sec) (glob) (zstd no-rust !) |
| 241 |
stream-cloned 1096 files / 99.0 KB in * seconds (* */sec) (glob) (zstd rust !) |
| 242 |
#endif |
| 243 |
|
| 244 |
#if no-stream-legacy |
| 245 |
$ ls -1 clone1/.hg/cache |
| 246 |
branch2-base |
| 247 |
branch2-served |
| 248 |
rbc-names-v2 |
| 249 |
rbc-revs-v2 |
| 250 |
tags2 |
| 251 |
tags2-served |
| 252 |
#endif |
| 253 |
|
| 254 |
$ hg -R clone1 verify --quiet |
| 255 |
$ cat server/errors.txt |
| 256 |
|
| 257 |
getbundle requests with stream=1 are uncompressed |
| 258 |
------------------------------------------------- |
| 259 |
|
| 260 |
We check that `getbundle` will return a stream bundle when requested. |
| 261 |
|
| 262 |
XXX manually building the --requestheader is fragile and will drift away from actual usage |
| 263 |
|
| 264 |
$ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle' content-type --bodyfile body --hgproto '0.1 0.2 comp=zlib,none' --requestheader "x-hgarg-1=bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Astream%253Dv2&cg=0&common=0000000000000000000000000000000000000000&heads=c17445101a72edac06facd130d14808dfbd5c7c2&stream=1" |
| 265 |
200 Script output follows |
| 266 |
content-type: application/mercurial-0.2 |
| 267 |
|
| 268 |
|
| 269 |
$ f --size --hex --bytes 48 body |
| 270 |
body: size=* (glob) |
| 271 |
0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......| |
| 272 |
0010: ?? 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |?.STREAM2.......| (glob) |
| 273 |
0020: 06 09 04 0c ?? 62 79 74 65 63 6f 75 6e 74 31 30 |....?bytecount10| (glob) |
| 274 |
|
| 275 |
--uncompressed is an alias to --stream |
| 276 |
--------------------------------------- |
| 277 |
|
| 278 |
The alias flag should trigger a stream clone too. |
| 279 |
|
| 280 |
$ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed |
| 281 |
streaming all changes |
| 282 |
* files to transfer* (glob) (no-stream-bundle2-v3 !) |
| 283 |
* entries to transfer (glob) (stream-bundle2-v3 !) |
| 284 |
stream-cloned * files / * KB in * seconds (* */sec) (glob) |
| 285 |
searching for changes (stream-legacy !) |
| 286 |
no changes found (stream-legacy !) |
| 287 |
|
| 288 |
Stream clones can be disabled |
| 289 |
----------------------------- |
| 290 |
|
| 291 |
--no-stream and --no-uncompressed do not get a stream clone. |
| 292 |
|
| 293 |
$ hg clone --no-uncompressed -U http://localhost:$HGPORT clone1-regular1 |
| 294 |
requesting all changes |
| 295 |
adding changesets |
| 296 |
adding manifests |
| 297 |
adding file changes |
| 298 |
added 3 changesets with 1088 changes to 1088 files |
| 299 |
new changesets 96ee1d7354c4:5223b5e3265f |
| 300 |
$ hg clone --no-stream -U http://localhost:$HGPORT clone1-regular2 |
| 301 |
requesting all changes |
| 302 |
adding changesets |
| 303 |
adding manifests |
| 304 |
adding file changes |
| 305 |
added 3 changesets with 1088 changes to 1088 files |
| 306 |
new changesets 96ee1d7354c4:5223b5e3265f |
| 307 |
|
| 308 |
Clone with background file closing enabled |
| 309 |
------------------------------------------- |
| 310 |
|
| 311 |
The backgound file closing logic should trigger when configured to do so, and |
| 312 |
the result should be a valid repository. |
| 313 |
|
| 314 |
$ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --stream -U http://localhost:$HGPORT clone-background | grep "background file closing" |
| 315 |
starting 4 threads for background file closing |
| 316 |
starting 4 threads for background file closing (no-stream-legacy !) |
| 317 |
$ hg verify -R clone-background --quiet |
| 318 |
|
| 319 |
Cannot stream clone when there are secret changesets |
| 320 |
---------------------------------------------------- |
| 321 |
|
| 322 |
If secret changeset are present the should not be cloned (by default) and the |
| 323 |
clone falls back to a bundle clone. |
| 324 |
|
| 325 |
$ hg -R server phase --force --secret -r tip |
| 326 |
$ hg clone --stream -U http://localhost:$HGPORT secret-denied |
| 327 |
warning: stream clone requested but server has them disabled |
| 328 |
requesting all changes |
| 329 |
adding changesets |
| 330 |
adding manifests |
| 331 |
adding file changes |
| 332 |
added 2 changesets with 1025 changes to 1025 files |
| 333 |
new changesets 96ee1d7354c4:c17445101a72 |
| 334 |
|
| 335 |
$ killdaemons.py |
| 336 |
|
| 337 |
Streaming of secrets can be overridden by server config |
| 338 |
------------------------------------------------------- |
| 339 |
|
| 340 |
Secret changeset can still be streamed if the server is configured to do so. |
| 341 |
|
| 342 |
$ cd server |
| 343 |
$ hg serve --config server.uncompressedallowsecret=true -p $HGPORT -d --pid-file=hg.pid |
| 344 |
$ cat hg.pid > $DAEMON_PIDS |
| 345 |
$ cd .. |
| 346 |
|
| 347 |
$ hg clone --stream -U http://localhost:$HGPORT secret-allowed |
| 348 |
streaming all changes |
| 349 |
* files to transfer* (glob) (no-stream-bundle2-v3 !) |
| 350 |
* entries to transfer (glob) (stream-bundle2-v3 !) |
| 351 |
stream-cloned * files / * KB in * seconds (* */sec) (glob) |
| 352 |
searching for changes (stream-legacy !) |
| 353 |
no changes found (stream-legacy !) |
| 354 |
|
| 355 |
$ killdaemons.py |
| 356 |
|
| 357 |
Verify interaction between preferuncompressed and secret presence |
| 358 |
----------------------------------------------------------------- |
| 359 |
|
| 360 |
Secret presence will still make the clone falls back to a normal bundle even if |
| 361 |
the server prefers stream clone. |
| 362 |
|
| 363 |
$ cd server |
| 364 |
$ hg serve --config server.preferuncompressed=true -p $HGPORT -d --pid-file=hg.pid |
| 365 |
$ cat hg.pid > $DAEMON_PIDS |
| 366 |
$ cd .. |
| 367 |
|
| 368 |
$ hg clone -U http://localhost:$HGPORT preferuncompressed-secret |
| 369 |
requesting all changes |
| 370 |
adding changesets |
| 371 |
adding manifests |
| 372 |
adding file changes |
| 373 |
added 2 changesets with 1025 changes to 1025 files |
| 374 |
new changesets 96ee1d7354c4:c17445101a72 |
| 375 |
|
| 376 |
$ killdaemons.py |
| 377 |
|
| 378 |
Clone not allowed when full bundles disabled and can't serve secrets |
| 379 |
-------------------------------------------------------------------- |
| 380 |
|
| 381 |
The clone should fail as no valid option is found. |
| 382 |
|
| 383 |
$ cd server |
| 384 |
$ hg serve --config server.disablefullbundle=true -p $HGPORT -d --pid-file=hg.pid |
| 385 |
$ cat hg.pid > $DAEMON_PIDS |
| 386 |
$ cd .. |
| 387 |
|
| 388 |
$ hg clone --stream http://localhost:$HGPORT secret-full-disabled |
| 389 |
warning: stream clone requested but server has them disabled |
| 390 |
requesting all changes |
| 391 |
remote: abort: server has pull-based clones disabled |
| 392 |
abort: pull failed on remote |
| 393 |
(remove --pull if specified or upgrade Mercurial) |
| 394 |
[100] |
| 395 |
|
| 396 |
Local stream clone with secrets involved |
| 397 |
---------------------------------------- |
| 398 |
|
| 399 |
(This is just a test over behavior: if you have access to the repo's files, |
| 400 |
there is no security so it isn't important to prevent a clone here.) |
| 401 |
|
| 402 |
$ hg clone -U --stream server local-secret |
| 403 |
warning: stream clone requested but server has them disabled |
| 404 |
requesting all changes |
| 405 |
adding changesets |
| 406 |
adding manifests |
| 407 |
adding file changes |
| 408 |
added 2 changesets with 1025 changes to 1025 files |
| 409 |
new changesets 96ee1d7354c4:c17445101a72 |
| 410 |
|
| 411 |
(revert introduction of secret changeset) |
| 412 |
|
| 413 |
$ hg -R server phase --draft 'secret()' |
| 414 |
|
| 415 |
Stream clone while repo is changing: |
| 416 |
------------------------------------ |
| 417 |
|
| 418 |
We should send a repository in a valid state, ignoring the ongoing transaction. |
| 419 |
|
| 420 |
$ mkdir changing |
| 421 |
$ cd changing |
| 422 |
|
| 423 |
prepare repo with small and big file to cover both code paths in emitrevlogdata |
| 424 |
(inlined revlog and non-inlined revlogs). |
| 425 |
|
| 426 |
$ hg init repo |
| 427 |
$ touch repo/f1 |
| 428 |
$ $TESTDIR/seq.py 50000 > repo/f2 |
| 429 |
$ hg -R repo ci -Aqm "0" |
| 430 |
$ HG_TEST_STREAM_WALKED_FILE_1="$TESTTMP/sync_file_walked_1" |
| 431 |
$ export HG_TEST_STREAM_WALKED_FILE_1 |
| 432 |
$ HG_TEST_STREAM_WALKED_FILE_2="$TESTTMP/sync_file_walked_2" |
| 433 |
$ export HG_TEST_STREAM_WALKED_FILE_2 |
| 434 |
$ HG_TEST_STREAM_WALKED_FILE_3="$TESTTMP/sync_file_walked_3" |
| 435 |
$ export HG_TEST_STREAM_WALKED_FILE_3 |
| 436 |
$ HG_TEST_STREAM_WALKED_FILE_4="$TESTTMP/sync_file_walked_4" |
| 437 |
$ export HG_TEST_STREAM_WALKED_FILE_4 |
| 438 |
$ HG_TEST_STREAM_WALKED_FILE_5="$TESTTMP/sync_file_walked_5" |
| 439 |
$ export HG_TEST_STREAM_WALKED_FILE_5 |
| 440 |
# $ cat << EOF >> $HGRCPATH |
| 441 |
# > [hooks] |
| 442 |
# > pre-clone=rm -f "$TESTTMP/sync_file_walked_*" |
| 443 |
# > EOF |
| 444 |
$ hg serve -R repo -p $HGPORT1 -d --error errors.log --pid-file=hg.pid --config extensions.stream_steps="$RUNTESTDIR/testlib/ext-stream-clone-steps.py" |
| 445 |
$ cat hg.pid >> $DAEMON_PIDS |
| 446 |
|
| 447 |
clone while modifying the repo between stating file with write lock and |
| 448 |
actually serving file content |
| 449 |
|
| 450 |
also delete some cache in the process |
| 451 |
|
| 452 |
$ (hg clone -q --stream -U http://localhost:$HGPORT1 clone; touch "$HG_TEST_STREAM_WALKED_FILE_5") & |
| 453 |
|
| 454 |
$ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_1 |
| 455 |
(delete one file) |
| 456 |
$ ls repo/.hg/cache/rbc-revs-v2 |
| 457 |
repo/.hg/cache/rbc-revs-v2 |
| 458 |
$ rm repo/.hg/cache/rbc-revs-v2 |
| 459 |
(truncate another) |
| 460 |
$ ls repo/.hg/cache/rbc-names-v2 |
| 461 |
repo/.hg/cache/rbc-names-v2 |
| 462 |
$ echo football > repo/.hg/cache/rbc-names-v2 |
| 463 |
(lenghten another one) |
| 464 |
$ ls repo/.hg/cache/branch2-served |
| 465 |
repo/.hg/cache/branch2-served |
| 466 |
$ echo bar >> repo/.hg/cache/branch2-served |
| 467 |
(remove one in wcache)) |
| 468 |
$ ls repo/.hg/wcache/manifestfulltextcache |
| 469 |
repo/.hg/wcache/manifestfulltextcache |
| 470 |
$ rm repo/.hg/wcache/manifestfulltextcache |
| 471 |
$ touch $HG_TEST_STREAM_WALKED_FILE_2 |
| 472 |
|
| 473 |
$ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3 |
| 474 |
$ echo >> repo/f1 |
| 475 |
$ echo >> repo/f2 |
| 476 |
$ hg -R repo ci -m "1" --config ui.timeout.warn=-1 |
| 477 |
(truncate further) |
| 478 |
$ ls repo/.hg/cache/rbc-names-v2 |
| 479 |
repo/.hg/cache/rbc-names-v2 |
| 480 |
$ echo foo > repo/.hg/cache/rbc-names-v2 |
| 481 |
(lenghten another one) |
| 482 |
$ ls repo/.hg/cache/branch2-served |
| 483 |
repo/.hg/cache/branch2-served |
| 484 |
$ echo babar >> repo/.hg/cache/branch2-served |
| 485 |
$ touch $HG_TEST_STREAM_WALKED_FILE_4 |
| 486 |
$ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_5 |
| 487 |
$ hg -R clone id |
| 488 |
000000000000 |
| 489 |
$ hg -R clone verify --quiet |
| 490 |
$ cat errors.log |
| 491 |
$ cd .. |
| 492 |
|
| 493 |
Stream repository with bookmarks |
| 494 |
-------------------------------- |
| 495 |
|
| 496 |
The bookmark file should be send over in the stream bundle. |
| 497 |
|
| 498 |
add a bookmark |
| 499 |
|
| 500 |
$ hg -R server bookmark -r tip some-bookmark |
| 501 |
|
| 502 |
clone it |
| 503 |
|
| 504 |
$ hg clone --stream http://localhost:$HGPORT with-bookmarks |
| 505 |
streaming all changes |
| 506 |
1091 files to transfer, * KB of data (glob) (stream-legacy !) |
| 507 |
1097 files to transfer, * KB of data (glob) (stream-bundle2-v2 no-rust !) |
| 508 |
1099 files to transfer, * KB of data (glob) (stream-bundle2-v2 rust !) |
| 509 |
1096 entries to transfer (stream-bundle2-v3 !) |
| 510 |
stream-cloned * files / * KB in * seconds (* */sec) (glob) |
| 511 |
searching for changes (stream-legacy !) |
| 512 |
no changes found (stream-legacy !) |
| 513 |
updating to branch default |
| 514 |
1088 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 515 |
$ hg verify -R with-bookmarks -q |
| 516 |
$ hg -R with-bookmarks bookmarks |
| 517 |
some-bookmark 2:5223b5e3265f |
| 518 |
|
| 519 |
Stream repository with phases |
| 520 |
----------------------------- |
| 521 |
|
| 522 |
The file storing phases information (e.g. phaseroots) should be sent as part of |
| 523 |
the stream bundle. |
| 524 |
|
| 525 |
Clone as publishing |
| 526 |
|
| 527 |
$ hg -R server phase -r 'all()' |
| 528 |
0: draft |
| 529 |
1: draft |
| 530 |
2: draft |
| 531 |
|
| 532 |
$ hg clone --stream http://localhost:$HGPORT phase-publish |
| 533 |
streaming all changes |
| 534 |
1091 files to transfer, * KB of data (glob) (stream-legacy !) |
| 535 |
1097 files to transfer, * KB of data (glob) (stream-bundle2-v2 no-rust !) |
| 536 |
1099 files to transfer, * KB of data (glob) (stream-bundle2-v2 rust !) |
| 537 |
1096 entries to transfer (stream-bundle2-v3 !) |
| 538 |
stream-cloned * files * KB in * seconds (* */sec) (glob) |
| 539 |
searching for changes (stream-legacy !) |
| 540 |
no changes found (stream-legacy !) |
| 541 |
updating to branch default |
| 542 |
1088 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 543 |
$ hg verify -R phase-publish -q |
| 544 |
$ hg -R phase-publish phase -r 'all()' |
| 545 |
0: public |
| 546 |
1: public |
| 547 |
2: public |
| 548 |
|
| 549 |
Clone as non publishing |
| 550 |
|
| 551 |
$ cat << EOF >> server/.hg/hgrc |
| 552 |
> [phases] |
| 553 |
> publish = False |
| 554 |
> EOF |
| 555 |
$ killdaemons.py |
| 556 |
$ hg -R server serve -p $HGPORT -d --pid-file=hg.pid |
| 557 |
$ cat hg.pid > $DAEMON_PIDS |
| 558 |
|
| 559 |
$ hg clone --stream http://localhost:$HGPORT phase-no-publish |
| 560 |
streaming all changes |
| 561 |
* files to transfer, * KB of data (glob) (no-stream-bundle2-v3 !) |
| 562 |
* entries to transfer (glob) (stream-bundle2-v3 !) |
| 563 |
stream-cloned * / * KB in * seconds (* */sec) (glob) |
| 564 |
searching for changes (stream-legacy !) |
| 565 |
no changes found (stream-legacy !) |
| 566 |
updating to branch default |
| 567 |
1088 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 568 |
|
| 569 |
Note: With v1 of the stream protocol, changeset are always cloned as public. It |
| 570 |
make stream v1 unsuitable for non-publishing repository. |
| 571 |
|
| 572 |
$ hg -R phase-no-publish phase -r 'all()' |
| 573 |
0: public (stream-legacy !) |
| 574 |
1: public (stream-legacy !) |
| 575 |
2: public (stream-legacy !) |
| 576 |
0: draft (no-stream-legacy !) |
| 577 |
1: draft (no-stream-legacy !) |
| 578 |
2: draft (no-stream-legacy !) |
| 579 |
$ hg verify -R phase-no-publish -q |
| 580 |
|
| 581 |
$ killdaemons.py |
| 582 |
|
| 583 |
|
| 584 |
Stream repository with obsolescence |
| 585 |
----------------------------------- |
| 586 |
|
| 587 |
#if stream-legacy |
| 588 |
|
| 589 |
With v1 of the stream protocol, changeset are always cloned as public. There's |
| 590 |
no obsolescence markers exchange in stream v1. |
| 591 |
|
| 592 |
#else |
| 593 |
|
| 594 |
Clone non-publishing with obsolescence |
| 595 |
|
| 596 |
The obsstore file should be send as part of the stream bundle |
| 597 |
|
| 598 |
$ cat >> $HGRCPATH << EOF |
| 599 |
> [experimental] |
| 600 |
> evolution=all |
| 601 |
> EOF |
| 602 |
|
| 603 |
$ cd server |
| 604 |
$ echo foo > foo |
| 605 |
$ hg -q commit -m 'about to be pruned' |
| 606 |
$ hg debugobsolete `hg log -r . -T '{node}'` -d '0 0' -u test --record-parents |
| 607 |
1 new obsolescence markers |
| 608 |
obsoleted 1 changesets |
| 609 |
$ hg up null -q |
| 610 |
$ hg log -T '{rev}: {phase}\n' |
| 611 |
2: draft |
| 612 |
1: draft |
| 613 |
0: draft |
| 614 |
$ hg serve -p $HGPORT -d --pid-file=hg.pid |
| 615 |
$ cat hg.pid > $DAEMON_PIDS |
| 616 |
$ cd .. |
| 617 |
|
| 618 |
$ hg clone -U --stream http://localhost:$HGPORT with-obsolescence |
| 619 |
streaming all changes |
| 620 |
1099 files to transfer, * KB of data (glob) (stream-bundle2-v2 no-rust !) |
| 621 |
1101 files to transfer, * KB of data (glob) (stream-bundle2-v2 rust !) |
| 622 |
1098 entries to transfer (no-stream-bundle2-v2 !) |
| 623 |
stream-cloned * files / * KB in * seconds (* */sec) (glob) |
| 624 |
$ hg -R with-obsolescence log -T '{rev}: {phase}\n' |
| 625 |
2: draft |
| 626 |
1: draft |
| 627 |
0: draft |
| 628 |
$ hg debugobsolete -R with-obsolescence |
| 629 |
8c206a663911c1f97f2f9d7382e417ae55872cfa 0 {5223b5e3265f0df40bb743da62249413d74ac70f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
| 630 |
$ hg verify -R with-obsolescence -q |
| 631 |
|
| 632 |
$ hg clone -U --stream --config experimental.evolution=0 http://localhost:$HGPORT with-obsolescence-no-evolution |
| 633 |
streaming all changes |
| 634 |
remote: abort: server has obsolescence markers, but client cannot receive them via stream clone |
| 635 |
abort: pull failed on remote |
| 636 |
[100] |
| 637 |
|
| 638 |
$ killdaemons.py |
| 639 |
|
| 640 |
#endif |
| 641 |
|
| 642 |
Cloning a repo with no requirements doesn't give some obscure error |
| 643 |
------------------------------------------------------------------- |
| 644 |
|
| 645 |
$ mkdir -p empty-repo/.hg |
| 646 |
$ hg clone -q --stream ssh://user@dummy/empty-repo empty-repo2 |
| 647 |
$ hg --cwd empty-repo2 verify -q |
| 648 |
|
| 649 |
Cloning a repo with an empty manifestlog doesn't give some weird error |
| 650 |
---------------------------------------------------------------------- |
| 651 |
|
| 652 |
$ rm -r empty-repo; hg init empty-repo |
| 653 |
$ (cd empty-repo; touch x; hg commit -Am empty; hg debugstrip -r 0) > /dev/null |
| 654 |
$ hg clone -q --stream ssh://user@dummy/empty-repo empty-repo3 |
| 655 |
$ hg --cwd empty-repo3 verify -q |
| 656 |
|
| 657 |
Compression requirements are preserved across a stream clone |
| 658 |
------------------------------------------------------------ |
| 659 |
|
| 660 |
$ hg init zlib-repo --config format.revlog-compression=zlib |
| 661 |
$ hg clone -q --stream ssh://user@dummy/zlib-repo zlib-clone |
| 662 |
|
| 663 |
$ hg -R zlib-repo/ debugrequires | grep compression |
| 664 |
[1] |
| 665 |
$ hg -R zlib-clone debugrequires | grep compression |
| 666 |
[1] |
| 667 |
|
| 668 |
#if zstd |
| 669 |
|
| 670 |
$ hg init zstd-repo --config format.revlog-compression=zstd |
| 671 |
$ hg clone -q --stream ssh://user@dummy/zstd-repo zstd-clone |
| 672 |
|
| 673 |
$ hg -R zstd-repo debugrequires | grep compression |
| 674 |
revlog-compression-zstd |
| 675 |
$ hg -R zstd-clone debugrequires | grep compression |
| 676 |
revlog-compression-zstd |
| 677 |
|
| 678 |
#endif |