| 1 |
|
| 2 |
#testcases bundle1 bundle2 |
| 3 |
|
| 4 |
#if bundle1 |
| 5 |
$ cat << EOF >> $HGRCPATH |
| 6 |
> [devel] |
| 7 |
> # This test is dedicated to interaction through old bundle |
| 8 |
> legacy.exchange = bundle1 |
| 9 |
> EOF |
| 10 |
#endif |
| 11 |
|
| 12 |
$ hg init test |
| 13 |
$ cd test |
| 14 |
$ echo a > a |
| 15 |
$ hg ci -Ama |
| 16 |
adding a |
| 17 |
$ cd .. |
| 18 |
$ hg clone test test2 |
| 19 |
updating to branch default |
| 20 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 21 |
$ cd test2 |
| 22 |
$ echo a >> a |
| 23 |
$ hg ci -mb |
| 24 |
$ req() { |
| 25 |
> hg $1 serve -p $HGPORT -d --pid-file=hg.pid -E errors.log |
| 26 |
> cat hg.pid >> $DAEMON_PIDS |
| 27 |
> hg --cwd ../test2 push http://localhost:$HGPORT/ |
| 28 |
> exitstatus=$? |
| 29 |
> killdaemons.py |
| 30 |
> echo % serve errors |
| 31 |
> cat errors.log |
| 32 |
> return $exitstatus |
| 33 |
> } |
| 34 |
$ cd ../test |
| 35 |
|
| 36 |
expect ssl error |
| 37 |
|
| 38 |
$ req |
| 39 |
pushing to http://localhost:$HGPORT/ |
| 40 |
searching for changes |
| 41 |
abort: HTTP Error 403: ssl required |
| 42 |
% serve errors |
| 43 |
[100] |
| 44 |
|
| 45 |
expect authorization error |
| 46 |
|
| 47 |
$ echo '[web]' > .hg/hgrc |
| 48 |
$ echo 'push_ssl = false' >> .hg/hgrc |
| 49 |
$ req |
| 50 |
pushing to http://localhost:$HGPORT/ |
| 51 |
searching for changes |
| 52 |
abort: authorization failed |
| 53 |
% serve errors |
| 54 |
[255] |
| 55 |
|
| 56 |
expect authorization error: must have authorized user |
| 57 |
|
| 58 |
$ echo 'allow_push = unperson' >> .hg/hgrc |
| 59 |
$ req |
| 60 |
pushing to http://localhost:$HGPORT/ |
| 61 |
searching for changes |
| 62 |
abort: authorization failed |
| 63 |
% serve errors |
| 64 |
[255] |
| 65 |
|
| 66 |
expect success |
| 67 |
|
| 68 |
$ cat > $TESTTMP/hook.sh <<'EOF' |
| 69 |
> echo "phase-move: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE" |
| 70 |
> EOF |
| 71 |
|
| 72 |
#if bundle1 |
| 73 |
$ cat >> .hg/hgrc <<EOF |
| 74 |
> allow_push = * |
| 75 |
> [hooks] |
| 76 |
> changegroup = sh -c "printenv.py --line changegroup 0" |
| 77 |
> pushkey = sh -c "printenv.py --line pushkey 0" |
| 78 |
> txnclose-phase.test = sh $TESTTMP/hook.sh |
| 79 |
> EOF |
| 80 |
$ req "--debug --config extensions.blackbox=" |
| 81 |
listening at http://*:$HGPORT/ (bound to $LOCALIP:$HGPORT) (glob) (?) |
| 82 |
pushing to http://localhost:$HGPORT/ |
| 83 |
searching for changes |
| 84 |
remote: redirecting incoming bundle to */hg-unbundle-* (glob) |
| 85 |
remote: adding changesets |
| 86 |
remote: add changeset ba677d0156c1 |
| 87 |
remote: adding manifests |
| 88 |
remote: adding file changes |
| 89 |
remote: adding a revisions |
| 90 |
remote: updating the branch cache |
| 91 |
remote: added 1 changesets with 1 changes to 1 files |
| 92 |
remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh |
| 93 |
remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public |
| 94 |
remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh |
| 95 |
remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public |
| 96 |
remote: running hook changegroup: sh -c "printenv.py --line changegroup 0" |
| 97 |
remote: changegroup hook: HG_HOOKNAME=changegroup |
| 98 |
remote: HG_HOOKTYPE=changegroup |
| 99 |
remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 100 |
remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 101 |
remote: HG_SOURCE=serve |
| 102 |
remote: HG_TXNID=TXN:$ID$ |
| 103 |
remote: HG_TXNNAME=serve |
| 104 |
remote: remote:http:$LOCALIP: (glob) |
| 105 |
remote: HG_URL=remote:http:$LOCALIP: (glob) |
| 106 |
remote: |
| 107 |
% serve errors |
| 108 |
$ hg rollback |
| 109 |
repository tip rolled back to revision 0 (undo serve) |
| 110 |
$ req "--debug --config server.streamunbundle=True --config extensions.blackbox=" |
| 111 |
listening at http://*:$HGPORT/ (bound to $LOCALIP:$HGPORT) (glob) (?) |
| 112 |
pushing to http://localhost:$HGPORT/ |
| 113 |
searching for changes |
| 114 |
remote: adding changesets |
| 115 |
remote: add changeset ba677d0156c1 |
| 116 |
remote: adding manifests |
| 117 |
remote: adding file changes |
| 118 |
remote: adding a revisions |
| 119 |
remote: updating the branch cache |
| 120 |
remote: added 1 changesets with 1 changes to 1 files |
| 121 |
remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh |
| 122 |
remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public |
| 123 |
remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh |
| 124 |
remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public |
| 125 |
remote: running hook changegroup: sh -c "printenv.py --line changegroup 0" |
| 126 |
remote: changegroup hook: HG_HOOKNAME=changegroup |
| 127 |
remote: HG_HOOKTYPE=changegroup |
| 128 |
remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 129 |
remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 130 |
remote: HG_SOURCE=serve |
| 131 |
remote: HG_TXNID=TXN:$ID$ |
| 132 |
remote: HG_TXNNAME=serve |
| 133 |
remote: remote:http:$LOCALIP: (glob) |
| 134 |
remote: HG_URL=remote:http:$LOCALIP: (glob) |
| 135 |
remote: |
| 136 |
% serve errors |
| 137 |
$ hg rollback |
| 138 |
repository tip rolled back to revision 0 (undo serve) |
| 139 |
#endif |
| 140 |
|
| 141 |
#if bundle2 |
| 142 |
$ cat >> .hg/hgrc <<EOF |
| 143 |
> allow_push = * |
| 144 |
> [hooks] |
| 145 |
> changegroup = sh -c "printenv.py --line changegroup 0" |
| 146 |
> pushkey = sh -c "printenv.py --line pushkey 0" |
| 147 |
> txnclose-phase.test = sh $TESTTMP/hook.sh |
| 148 |
> EOF |
| 149 |
$ req |
| 150 |
pushing to http://localhost:$HGPORT/ |
| 151 |
searching for changes |
| 152 |
remote: adding changesets |
| 153 |
remote: adding manifests |
| 154 |
remote: adding file changes |
| 155 |
remote: added 1 changesets with 1 changes to 1 files |
| 156 |
remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public |
| 157 |
remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public |
| 158 |
remote: changegroup hook: HG_BUNDLE2=1 |
| 159 |
remote: HG_HOOKNAME=changegroup |
| 160 |
remote: HG_HOOKTYPE=changegroup |
| 161 |
remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 162 |
remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 163 |
remote: HG_SOURCE=serve |
| 164 |
remote: HG_TXNID=TXN:$ID$ |
| 165 |
remote: HG_TXNNAME=serve |
| 166 |
remote: HG_URL=remote:http:$LOCALIP: (glob) |
| 167 |
remote: |
| 168 |
% serve errors |
| 169 |
$ hg rollback |
| 170 |
repository tip rolled back to revision 0 (undo serve) |
| 171 |
#endif |
| 172 |
|
| 173 |
expect success, server lacks the httpheader capability |
| 174 |
|
| 175 |
$ CAP=httpheader |
| 176 |
$ . "$TESTDIR/notcapable" |
| 177 |
$ req |
| 178 |
pushing to http://localhost:$HGPORT/ |
| 179 |
searching for changes |
| 180 |
remote: adding changesets |
| 181 |
remote: adding manifests |
| 182 |
remote: adding file changes |
| 183 |
remote: added 1 changesets with 1 changes to 1 files |
| 184 |
remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public |
| 185 |
remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public |
| 186 |
remote: changegroup hook: HG_HOOKNAME=changegroup (no-bundle2 !) |
| 187 |
remote: changegroup hook: HG_BUNDLE2=1 (bundle2 !) |
| 188 |
remote: HG_HOOKNAME=changegroup (bundle2 !) |
| 189 |
remote: HG_HOOKTYPE=changegroup |
| 190 |
remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 191 |
remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 192 |
remote: HG_SOURCE=serve |
| 193 |
remote: HG_TXNID=TXN:$ID$ |
| 194 |
remote: HG_TXNNAME=serve |
| 195 |
remote: remote:http:$LOCALIP: (glob) (no-bundle2 !) |
| 196 |
remote: HG_URL=remote:http:$LOCALIP: (glob) |
| 197 |
remote: |
| 198 |
% serve errors |
| 199 |
$ hg rollback |
| 200 |
repository tip rolled back to revision 0 (undo serve) |
| 201 |
|
| 202 |
expect success, server lacks the unbundlehash capability |
| 203 |
|
| 204 |
$ CAP=unbundlehash |
| 205 |
$ . "$TESTDIR/notcapable" |
| 206 |
$ req |
| 207 |
pushing to http://localhost:$HGPORT/ |
| 208 |
searching for changes |
| 209 |
remote: adding changesets |
| 210 |
remote: adding manifests |
| 211 |
remote: adding file changes |
| 212 |
remote: added 1 changesets with 1 changes to 1 files |
| 213 |
remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public |
| 214 |
remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public |
| 215 |
remote: changegroup hook: HG_HOOKNAME=changegroup (no-bundle2 !) |
| 216 |
remote: changegroup hook: HG_BUNDLE2=1 (bundle2 !) |
| 217 |
remote: HG_HOOKNAME=changegroup (bundle2 !) |
| 218 |
remote: HG_HOOKTYPE=changegroup |
| 219 |
remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 220 |
remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 221 |
remote: HG_SOURCE=serve |
| 222 |
remote: HG_TXNID=TXN:$ID$ |
| 223 |
remote: HG_TXNNAME=serve |
| 224 |
remote: remote:http:$LOCALIP: (glob) (no-bundle2 !) |
| 225 |
remote: HG_URL=remote:http:$LOCALIP: (glob) |
| 226 |
remote: |
| 227 |
% serve errors |
| 228 |
$ hg rollback |
| 229 |
repository tip rolled back to revision 0 (undo serve) |
| 230 |
|
| 231 |
expect success, pre-d1b16a746db6 server supports the unbundle capability, but |
| 232 |
has no parameter |
| 233 |
|
| 234 |
$ cat <<EOF > notcapable-unbundleparam.py |
| 235 |
> from mercurial import extensions, httppeer |
| 236 |
> def capable(orig, self, name): |
| 237 |
> if name == 'unbundle': |
| 238 |
> return True |
| 239 |
> return orig(self, name) |
| 240 |
> def uisetup(ui): |
| 241 |
> extensions.wrapfunction(httppeer.httppeer, 'capable', capable) |
| 242 |
> EOF |
| 243 |
$ cp $HGRCPATH $HGRCPATH.orig |
| 244 |
$ cat <<EOF >> $HGRCPATH |
| 245 |
> [extensions] |
| 246 |
> notcapable-unbundleparam = `pwd`/notcapable-unbundleparam.py |
| 247 |
> EOF |
| 248 |
$ req |
| 249 |
pushing to http://localhost:$HGPORT/ |
| 250 |
searching for changes |
| 251 |
remote: adding changesets |
| 252 |
remote: adding manifests |
| 253 |
remote: adding file changes |
| 254 |
remote: added 1 changesets with 1 changes to 1 files |
| 255 |
remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public |
| 256 |
remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public |
| 257 |
remote: changegroup hook: * (glob) |
| 258 |
remote: HG_HOOKNAME=changegroup (bundle2 !) |
| 259 |
remote: HG_HOOKTYPE=changegroup |
| 260 |
remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 261 |
remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 262 |
remote: HG_SOURCE=serve |
| 263 |
remote: HG_TXNID=TXN:$ID$ |
| 264 |
remote: HG_TXNNAME=serve |
| 265 |
remote: remote:http:$LOCALIP: (glob) (no-bundle2 !) |
| 266 |
remote: HG_URL=remote:http:$LOCALIP: (glob) |
| 267 |
remote: |
| 268 |
% serve errors |
| 269 |
$ hg rollback |
| 270 |
repository tip rolled back to revision 0 (undo serve) |
| 271 |
$ mv $HGRCPATH.orig $HGRCPATH |
| 272 |
|
| 273 |
Test pushing to a publishing repository with a failing prepushkey hook |
| 274 |
|
| 275 |
$ cat > .hg/hgrc <<EOF |
| 276 |
> [web] |
| 277 |
> push_ssl = false |
| 278 |
> allow_push = * |
| 279 |
> [hooks] |
| 280 |
> prepushkey = sh -c "printenv.py --line prepushkey 1" |
| 281 |
> [devel] |
| 282 |
> legacy.exchange=phases |
| 283 |
> EOF |
| 284 |
|
| 285 |
#if bundle1 |
| 286 |
Bundle1 works because a) phases are updated as part of changegroup application |
| 287 |
and b) client checks phases after the "unbundle" command. Since it sees no |
| 288 |
phase changes are necessary, it doesn't send the "pushkey" command and the |
| 289 |
prepushkey hook never has to fire. |
| 290 |
|
| 291 |
$ req |
| 292 |
pushing to http://localhost:$HGPORT/ |
| 293 |
searching for changes |
| 294 |
remote: adding changesets |
| 295 |
remote: adding manifests |
| 296 |
remote: adding file changes |
| 297 |
remote: added 1 changesets with 1 changes to 1 files |
| 298 |
% serve errors |
| 299 |
|
| 300 |
#endif |
| 301 |
|
| 302 |
#if bundle2 |
| 303 |
Bundle2 sends a "pushkey" bundle2 part. This runs as part of the transaction |
| 304 |
and fails the entire push. |
| 305 |
$ req |
| 306 |
pushing to http://localhost:$HGPORT/ |
| 307 |
searching for changes |
| 308 |
remote: adding changesets |
| 309 |
remote: adding manifests |
| 310 |
remote: adding file changes |
| 311 |
remote: prepushkey hook: HG_BUNDLE2=1 |
| 312 |
remote: HG_HOOKNAME=prepushkey |
| 313 |
remote: HG_HOOKTYPE=prepushkey |
| 314 |
remote: HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 315 |
remote: HG_NAMESPACE=phases |
| 316 |
remote: HG_NEW=0 |
| 317 |
remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 318 |
remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 319 |
remote: HG_OLD=1 |
| 320 |
remote: HG_PENDING=$TESTTMP/test |
| 321 |
remote: HG_PHASES_MOVED=1 |
| 322 |
remote: HG_SOURCE=serve |
| 323 |
remote: HG_TXNID=TXN:$ID$ |
| 324 |
remote: HG_TXNNAME=serve |
| 325 |
remote: HG_URL=remote:http:$LOCALIP: (glob) |
| 326 |
remote: |
| 327 |
remote: pushkey-abort: prepushkey hook exited with status 1 |
| 328 |
remote: transaction abort! |
| 329 |
remote: rollback completed |
| 330 |
abort: updating ba677d0156c1 to public failed |
| 331 |
% serve errors |
| 332 |
[255] |
| 333 |
|
| 334 |
#endif |
| 335 |
|
| 336 |
Now remove the failing prepushkey hook. |
| 337 |
|
| 338 |
$ cat >> .hg/hgrc <<EOF |
| 339 |
> [hooks] |
| 340 |
> prepushkey = sh -c "printenv.py --line prepushkey 0" |
| 341 |
> EOF |
| 342 |
|
| 343 |
We don't need to test bundle1 because it succeeded above. |
| 344 |
|
| 345 |
#if bundle2 |
| 346 |
$ req |
| 347 |
pushing to http://localhost:$HGPORT/ |
| 348 |
searching for changes |
| 349 |
remote: adding changesets |
| 350 |
remote: adding manifests |
| 351 |
remote: adding file changes |
| 352 |
remote: prepushkey hook: HG_BUNDLE2=1 |
| 353 |
remote: HG_HOOKNAME=prepushkey |
| 354 |
remote: HG_HOOKTYPE=prepushkey |
| 355 |
remote: HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 356 |
remote: HG_NAMESPACE=phases |
| 357 |
remote: HG_NEW=0 |
| 358 |
remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 359 |
remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 360 |
remote: HG_OLD=1 |
| 361 |
remote: HG_PENDING=$TESTTMP/test |
| 362 |
remote: HG_PHASES_MOVED=1 |
| 363 |
remote: HG_SOURCE=serve |
| 364 |
remote: HG_TXNID=TXN:$ID$ |
| 365 |
remote: HG_TXNNAME=serve |
| 366 |
remote: HG_URL=remote:http:$LOCALIP: (glob) |
| 367 |
remote: |
| 368 |
remote: added 1 changesets with 1 changes to 1 files |
| 369 |
% serve errors |
| 370 |
#endif |
| 371 |
|
| 372 |
$ hg --config extensions.strip= strip -r 1: |
| 373 |
saved backup bundle to $TESTTMP/test/.hg/strip-backup/ba677d0156c1-eea704d7-backup.hg |
| 374 |
|
| 375 |
Now do a variant of the above, except on a non-publishing repository |
| 376 |
|
| 377 |
$ cat >> .hg/hgrc <<EOF |
| 378 |
> [phases] |
| 379 |
> publish = false |
| 380 |
> [hooks] |
| 381 |
> prepushkey = sh -c "printenv.py --line prepushkey 1" |
| 382 |
> EOF |
| 383 |
|
| 384 |
#if bundle1 |
| 385 |
$ req |
| 386 |
pushing to http://localhost:$HGPORT/ |
| 387 |
searching for changes |
| 388 |
remote: adding changesets |
| 389 |
remote: adding manifests |
| 390 |
remote: adding file changes |
| 391 |
remote: added 1 changesets with 1 changes to 1 files |
| 392 |
remote: prepushkey hook: HG_HOOKNAME=prepushkey |
| 393 |
remote: HG_HOOKTYPE=prepushkey |
| 394 |
remote: HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 395 |
remote: HG_NAMESPACE=phases |
| 396 |
remote: HG_NEW=0 |
| 397 |
remote: HG_OLD=1 |
| 398 |
remote: |
| 399 |
remote: pushkey-abort: prepushkey hook exited with status 1 |
| 400 |
updating ba677d0156c1 to public failed! |
| 401 |
% serve errors |
| 402 |
#endif |
| 403 |
|
| 404 |
#if bundle2 |
| 405 |
$ req |
| 406 |
pushing to http://localhost:$HGPORT/ |
| 407 |
searching for changes |
| 408 |
remote: adding changesets |
| 409 |
remote: adding manifests |
| 410 |
remote: adding file changes |
| 411 |
remote: prepushkey hook: HG_BUNDLE2=1 |
| 412 |
remote: HG_HOOKNAME=prepushkey |
| 413 |
remote: HG_HOOKTYPE=prepushkey |
| 414 |
remote: HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 415 |
remote: HG_NAMESPACE=phases |
| 416 |
remote: HG_NEW=0 |
| 417 |
remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 418 |
remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 419 |
remote: HG_OLD=1 |
| 420 |
remote: HG_PENDING=$TESTTMP/test |
| 421 |
remote: HG_PHASES_MOVED=1 |
| 422 |
remote: HG_SOURCE=serve |
| 423 |
remote: HG_TXNID=TXN:$ID$ |
| 424 |
remote: HG_TXNNAME=serve |
| 425 |
remote: HG_URL=remote:http:$LOCALIP: (glob) |
| 426 |
remote: |
| 427 |
remote: pushkey-abort: prepushkey hook exited with status 1 |
| 428 |
remote: transaction abort! |
| 429 |
remote: rollback completed |
| 430 |
abort: updating ba677d0156c1 to public failed |
| 431 |
% serve errors |
| 432 |
[255] |
| 433 |
#endif |
| 434 |
|
| 435 |
Make phases updates work |
| 436 |
|
| 437 |
$ cat >> .hg/hgrc <<EOF |
| 438 |
> [hooks] |
| 439 |
> prepushkey = sh -c "printenv.py --line prepushkey 0" |
| 440 |
> EOF |
| 441 |
|
| 442 |
#if bundle1 |
| 443 |
$ req |
| 444 |
pushing to http://localhost:$HGPORT/ |
| 445 |
searching for changes |
| 446 |
no changes found |
| 447 |
remote: prepushkey hook: HG_HOOKNAME=prepushkey |
| 448 |
remote: HG_HOOKTYPE=prepushkey |
| 449 |
remote: HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 450 |
remote: HG_NAMESPACE=phases |
| 451 |
remote: HG_NEW=0 |
| 452 |
remote: HG_OLD=1 |
| 453 |
remote: |
| 454 |
% serve errors |
| 455 |
[1] |
| 456 |
#endif |
| 457 |
|
| 458 |
#if bundle2 |
| 459 |
$ req |
| 460 |
pushing to http://localhost:$HGPORT/ |
| 461 |
searching for changes |
| 462 |
remote: adding changesets |
| 463 |
remote: adding manifests |
| 464 |
remote: adding file changes |
| 465 |
remote: prepushkey hook: HG_BUNDLE2=1 |
| 466 |
remote: HG_HOOKNAME=prepushkey |
| 467 |
remote: HG_HOOKTYPE=prepushkey |
| 468 |
remote: HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 469 |
remote: HG_NAMESPACE=phases |
| 470 |
remote: HG_NEW=0 |
| 471 |
remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 472 |
remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 |
| 473 |
remote: HG_OLD=1 |
| 474 |
remote: HG_PENDING=$TESTTMP/test |
| 475 |
remote: HG_PHASES_MOVED=1 |
| 476 |
remote: HG_SOURCE=serve |
| 477 |
remote: HG_TXNID=TXN:$ID$ |
| 478 |
remote: HG_TXNNAME=serve |
| 479 |
remote: HG_URL=remote:http:$LOCALIP: (glob) |
| 480 |
remote: |
| 481 |
remote: added 1 changesets with 1 changes to 1 files |
| 482 |
% serve errors |
| 483 |
#endif |
| 484 |
|
| 485 |
$ hg --config extensions.strip= strip -r 1: |
| 486 |
saved backup bundle to $TESTTMP/test/.hg/strip-backup/ba677d0156c1-eea704d7-backup.hg |
| 487 |
|
| 488 |
#if bundle2 |
| 489 |
|
| 490 |
$ cat > .hg/hgrc <<EOF |
| 491 |
> [web] |
| 492 |
> push_ssl = false |
| 493 |
> allow_push = * |
| 494 |
> [experimental] |
| 495 |
> httppostargs=true |
| 496 |
> EOF |
| 497 |
$ req |
| 498 |
pushing to http://localhost:$HGPORT/ |
| 499 |
searching for changes |
| 500 |
remote: adding changesets |
| 501 |
remote: adding manifests |
| 502 |
remote: adding file changes |
| 503 |
remote: added 1 changesets with 1 changes to 1 files |
| 504 |
% serve errors |
| 505 |
|
| 506 |
#endif |
| 507 |
|
| 508 |
$ cd .. |
| 509 |
|
| 510 |
Pushing via hgwebdir works |
| 511 |
|
| 512 |
$ hg init hgwebdir |
| 513 |
$ cd hgwebdir |
| 514 |
$ echo 0 > a |
| 515 |
$ hg -q commit -A -m initial |
| 516 |
$ cd .. |
| 517 |
|
| 518 |
$ cat > web.conf << EOF |
| 519 |
> [paths] |
| 520 |
> / = * |
| 521 |
> [web] |
| 522 |
> push_ssl = false |
| 523 |
> allow_push = * |
| 524 |
> EOF |
| 525 |
|
| 526 |
$ hg serve --web-conf web.conf -p $HGPORT -d --pid-file hg.pid |
| 527 |
$ cat hg.pid >> $DAEMON_PIDS |
| 528 |
|
| 529 |
$ hg clone http://localhost:$HGPORT/hgwebdir hgwebdir-local |
| 530 |
requesting all changes |
| 531 |
adding changesets |
| 532 |
adding manifests |
| 533 |
adding file changes |
| 534 |
added 1 changesets with 1 changes to 1 files |
| 535 |
new changesets 98a3f8f02ba7 |
| 536 |
updating to branch default |
| 537 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 538 |
$ cd hgwebdir-local |
| 539 |
$ echo commit > a |
| 540 |
$ hg commit -m 'local commit' |
| 541 |
|
| 542 |
$ hg push |
| 543 |
pushing to http://localhost:$HGPORT/hgwebdir |
| 544 |
searching for changes |
| 545 |
remote: adding changesets |
| 546 |
remote: adding manifests |
| 547 |
remote: adding file changes |
| 548 |
remote: added 1 changesets with 1 changes to 1 files |
| 549 |
|
| 550 |
$ killdaemons.py |
| 551 |
|
| 552 |
|
| 553 |
Missing web configuration |
| 554 |
========================= |
| 555 |
|
| 556 |
Show behavior with an invalid filesystem path. The aborts happen before |
| 557 |
daemonizing, but the kill is in place in case something goes awry. |
| 558 |
|
| 559 |
Case 1: missing path component with a double glob |
| 560 |
$ cat > web-enoent.conf << EOF |
| 561 |
> [paths] |
| 562 |
> / = missing/** |
| 563 |
> EOF |
| 564 |
|
| 565 |
$ hg serve --web-conf web-enoent.conf -p $HGPORT -d --pid-file hg.pid |
| 566 |
abort: $ENOENT$: '$TESTTMP/hgwebdir-local/missing' |
| 567 |
[255] |
| 568 |
$ killdaemons.py hg.pid |
| 569 |
|
| 570 |
Case 2: missing path component with a single glob |
| 571 |
$ cat > web-enoent.conf << EOF |
| 572 |
> [paths] |
| 573 |
> / = missing/* |
| 574 |
> EOF |
| 575 |
|
| 576 |
$ hg serve --web-conf web-enoent.conf -p $HGPORT -d --pid-file hg.pid |
| 577 |
abort: $ENOENT$: '$TESTTMP/hgwebdir-local/missing' |
| 578 |
[255] |
| 579 |
$ killdaemons.py hg.pid |
| 580 |
|
| 581 |
Case 3: missing path component of a vanilla path |
| 582 |
$ cat > web-enoent.conf << EOF |
| 583 |
> [paths] |
| 584 |
> /missing = missing |
| 585 |
> EOF |
| 586 |
|
| 587 |
$ hg serve --web-conf web-enoent.conf -p $HGPORT -d --pid-file hg.pid -E errors.log |
| 588 |
abort: filesystem path is not a repository: 'missing' |
| 589 |
(this was mapped to server path 'missing') |
| 590 |
[10] |
| 591 |
|
| 592 |
Path exists, but is not a repo |
| 593 |
$ mkdir -p missing |
| 594 |
$ hg serve --web-conf web-enoent.conf -p $HGPORT -d --pid-file hg.pid -E errors.log |
| 595 |
abort: filesystem path is not a repository: 'missing' |
| 596 |
(this was mapped to server path 'missing') |
| 597 |
[10] |
| 598 |
|
| 599 |
What happens when we fake a repo? Looks like we get something repo-adjacent, |
| 600 |
but not initialized on disk. |
| 601 |
|
| 602 |
$ mkdir -p missing/.hg |
| 603 |
$ hg serve --web-conf web-enoent.conf -p $HGPORT -d --pid-file hg.pid -E errors.log |
| 604 |
|
| 605 |
$ hg id http://localhost:$HGPORT/missing |
| 606 |
000000000000 |
| 607 |
$ find missing/.hg | sort |
| 608 |
missing/.hg |
| 609 |
|
| 610 |
$ killdaemons.py hg.pid |
| 611 |
|
| 612 |
$ cat errors.log | "$PYTHON" $TESTDIR/filtertraceback.py |
| 613 |
$ rm -f errors.log |
| 614 |
|
| 615 |
$ cd .. |