| 1 |
#require serve |
| 2 |
|
| 3 |
$ hg init test |
| 4 |
$ cd test |
| 5 |
$ echo foo>foo |
| 6 |
$ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg |
| 7 |
$ echo foo>foo.d/foo |
| 8 |
$ echo bar>foo.d/bAr.hg.d/BaR |
| 9 |
$ echo bar>foo.d/baR.d.hg/bAR |
| 10 |
$ hg commit -A -m 1 |
| 11 |
adding foo |
| 12 |
adding foo.d/bAr.hg.d/BaR |
| 13 |
adding foo.d/baR.d.hg/bAR |
| 14 |
adding foo.d/foo |
| 15 |
$ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log |
| 16 |
$ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid |
| 17 |
|
| 18 |
Test server address cannot be reused |
| 19 |
|
| 20 |
$ hg serve -p $HGPORT1 2>&1 |
| 21 |
abort: cannot start server at 'localhost:$HGPORT1': $EADDRINUSE$ |
| 22 |
[255] |
| 23 |
|
| 24 |
$ cd .. |
| 25 |
$ cat hg1.pid hg2.pid >> $DAEMON_PIDS |
| 26 |
|
| 27 |
clone via stream |
| 28 |
|
| 29 |
$ hg clone --stream http://localhost:$HGPORT/ copy 2>&1 |
| 30 |
streaming all changes |
| 31 |
* files to transfer, * bytes of data (glob) |
| 32 |
stream-cloned * files / * bytes in * seconds (*/sec) (glob) |
| 33 |
updating to branch default |
| 34 |
4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 35 |
$ hg verify -R copy -q |
| 36 |
|
| 37 |
try to clone via stream, should use pull instead |
| 38 |
|
| 39 |
$ hg clone --stream http://localhost:$HGPORT1/ copy2 |
| 40 |
warning: stream clone requested but server has them disabled |
| 41 |
requesting all changes |
| 42 |
adding changesets |
| 43 |
adding manifests |
| 44 |
adding file changes |
| 45 |
added 1 changesets with 4 changes to 4 files |
| 46 |
new changesets 8b6053c928fe |
| 47 |
updating to branch default |
| 48 |
4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 49 |
|
| 50 |
try to clone via stream but missing requirements, so should use pull instead |
| 51 |
|
| 52 |
$ cat > $TESTTMP/removesupportedformat.py << EOF |
| 53 |
> from mercurial import localrepo |
| 54 |
> def reposetup(ui, repo): |
| 55 |
> local = repo.local() |
| 56 |
> if local is not None: |
| 57 |
> local.supported.remove(b'generaldelta') |
| 58 |
> EOF |
| 59 |
|
| 60 |
$ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --stream http://localhost:$HGPORT/ copy3 |
| 61 |
warning: stream clone requested but client is missing requirements: generaldelta |
| 62 |
(see https://www.mercurial-scm.org/wiki/MissingRequirement for more information) |
| 63 |
requesting all changes |
| 64 |
adding changesets |
| 65 |
adding manifests |
| 66 |
adding file changes |
| 67 |
added 1 changesets with 4 changes to 4 files |
| 68 |
new changesets 8b6053c928fe |
| 69 |
updating to branch default |
| 70 |
4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 71 |
|
| 72 |
clone via pull |
| 73 |
|
| 74 |
$ hg clone http://localhost:$HGPORT1/ copy-pull |
| 75 |
requesting all changes |
| 76 |
adding changesets |
| 77 |
adding manifests |
| 78 |
adding file changes |
| 79 |
added 1 changesets with 4 changes to 4 files |
| 80 |
new changesets 8b6053c928fe |
| 81 |
updating to branch default |
| 82 |
4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 83 |
$ hg verify -R copy-pull -q |
| 84 |
$ cd test |
| 85 |
$ echo bar > bar |
| 86 |
$ hg commit -A -d '1 0' -m 2 |
| 87 |
adding bar |
| 88 |
$ cd .. |
| 89 |
|
| 90 |
clone over http with --update |
| 91 |
|
| 92 |
$ hg clone http://localhost:$HGPORT1/ updated --update 0 |
| 93 |
requesting all changes |
| 94 |
adding changesets |
| 95 |
adding manifests |
| 96 |
adding file changes |
| 97 |
added 2 changesets with 5 changes to 5 files |
| 98 |
new changesets 8b6053c928fe:5fed3813f7f5 |
| 99 |
updating to branch default |
| 100 |
4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 101 |
$ hg log -r . -R updated |
| 102 |
changeset: 0:8b6053c928fe |
| 103 |
user: test |
| 104 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 105 |
summary: 1 |
| 106 |
|
| 107 |
$ rm -rf updated |
| 108 |
|
| 109 |
incoming via HTTP |
| 110 |
|
| 111 |
$ hg clone http://localhost:$HGPORT1/ --rev 0 partial |
| 112 |
adding changesets |
| 113 |
adding manifests |
| 114 |
adding file changes |
| 115 |
added 1 changesets with 4 changes to 4 files |
| 116 |
new changesets 8b6053c928fe |
| 117 |
updating to branch default |
| 118 |
4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 119 |
$ cd partial |
| 120 |
$ touch LOCAL |
| 121 |
$ hg ci -qAm LOCAL |
| 122 |
$ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n' |
| 123 |
comparing with http://localhost:$HGPORT1/ |
| 124 |
searching for changes |
| 125 |
2 |
| 126 |
$ cd .. |
| 127 |
|
| 128 |
pull |
| 129 |
|
| 130 |
$ cd copy-pull |
| 131 |
$ cat >> .hg/hgrc <<EOF |
| 132 |
> [hooks] |
| 133 |
> changegroup = sh -c "printenv.py --line changegroup" |
| 134 |
> EOF |
| 135 |
$ hg pull |
| 136 |
pulling from http://localhost:$HGPORT1/ |
| 137 |
searching for changes |
| 138 |
adding changesets |
| 139 |
adding manifests |
| 140 |
adding file changes |
| 141 |
added 1 changesets with 1 changes to 1 files |
| 142 |
new changesets 5fed3813f7f5 |
| 143 |
changegroup hook: HG_HOOKNAME=changegroup |
| 144 |
HG_HOOKTYPE=changegroup |
| 145 |
HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d |
| 146 |
HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d |
| 147 |
HG_SOURCE=pull |
| 148 |
HG_TXNID=TXN:$ID$ |
| 149 |
HG_TXNNAME=pull |
| 150 |
http://localhost:$HGPORT1/ |
| 151 |
HG_URL=http://localhost:$HGPORT1/ |
| 152 |
|
| 153 |
(run 'hg update' to get a working copy) |
| 154 |
$ cd .. |
| 155 |
|
| 156 |
clone from invalid URL |
| 157 |
|
| 158 |
$ hg clone http://localhost:$HGPORT/bad |
| 159 |
abort: HTTP Error 404: Not Found |
| 160 |
[100] |
| 161 |
|
| 162 |
test http authentication |
| 163 |
+ use the same server to test server side streaming preference |
| 164 |
|
| 165 |
$ cd test |
| 166 |
|
| 167 |
$ hg serve --config extensions.x=$TESTDIR/httpserverauth.py -p $HGPORT2 -d \ |
| 168 |
> --pid-file=pid --config server.preferuncompressed=True -E ../errors2.log \ |
| 169 |
> --config web.push_ssl=False --config web.allow_push=* -A ../access.log |
| 170 |
$ cat pid >> $DAEMON_PIDS |
| 171 |
|
| 172 |
$ cat << EOF > get_pass.py |
| 173 |
> from mercurial import util |
| 174 |
> def newgetpass(): |
| 175 |
> return "pass" |
| 176 |
> util.get_password = newgetpass |
| 177 |
> EOF |
| 178 |
|
| 179 |
$ hg id http://localhost:$HGPORT2/ |
| 180 |
abort: http authorization required for http://localhost:$HGPORT2/ |
| 181 |
[255] |
| 182 |
$ hg id http://localhost:$HGPORT2/ |
| 183 |
abort: http authorization required for http://localhost:$HGPORT2/ |
| 184 |
[255] |
| 185 |
$ hg id --config ui.interactive=true --debug http://localhost:$HGPORT2/ |
| 186 |
using http://localhost:$HGPORT2/ |
| 187 |
sending capabilities command |
| 188 |
http authorization required for http://localhost:$HGPORT2/ |
| 189 |
realm: mercurial |
| 190 |
user: abort: response expected |
| 191 |
[255] |
| 192 |
$ cat <<'EOF' | hg id --config ui.interactive=true --config ui.nontty=true --debug http://localhost:$HGPORT2/ |
| 193 |
> |
| 194 |
> EOF |
| 195 |
using http://localhost:$HGPORT2/ |
| 196 |
sending capabilities command |
| 197 |
http authorization required for http://localhost:$HGPORT2/ |
| 198 |
realm: mercurial |
| 199 |
user: |
| 200 |
password: abort: response expected |
| 201 |
[255] |
| 202 |
$ cat <<'EOF' | hg id --config ui.interactive=true --config ui.nontty=true --debug http://localhost:$HGPORT2/ |
| 203 |
> |
| 204 |
> |
| 205 |
> EOF |
| 206 |
using http://localhost:$HGPORT2/ |
| 207 |
sending capabilities command |
| 208 |
http authorization required for http://localhost:$HGPORT2/ |
| 209 |
realm: mercurial |
| 210 |
user: |
| 211 |
password: abort: authorization failed |
| 212 |
[255] |
| 213 |
$ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/ |
| 214 |
http authorization required for http://localhost:$HGPORT2/ |
| 215 |
realm: mercurial |
| 216 |
user: user |
| 217 |
password: 5fed3813f7f5 |
| 218 |
$ hg id http://user:pass@localhost:$HGPORT2/ |
| 219 |
5fed3813f7f5 |
| 220 |
$ echo '[auth]' >> .hg/hgrc |
| 221 |
$ echo 'l.schemes=http' >> .hg/hgrc |
| 222 |
$ echo 'l.prefix=lo' >> .hg/hgrc |
| 223 |
$ echo 'l.username=user' >> .hg/hgrc |
| 224 |
$ echo 'l.password=pass' >> .hg/hgrc |
| 225 |
$ hg id http://localhost:$HGPORT2/ |
| 226 |
5fed3813f7f5 |
| 227 |
$ hg id http://localhost:$HGPORT2/ |
| 228 |
5fed3813f7f5 |
| 229 |
$ hg id http://user@localhost:$HGPORT2/ |
| 230 |
5fed3813f7f5 |
| 231 |
|
| 232 |
$ cat > use_digests.py << EOF |
| 233 |
> from mercurial import ( |
| 234 |
> exthelper, |
| 235 |
> url, |
| 236 |
> ) |
| 237 |
> |
| 238 |
> eh = exthelper.exthelper() |
| 239 |
> uisetup = eh.finaluisetup |
| 240 |
> |
| 241 |
> @eh.wrapfunction(url, 'opener') |
| 242 |
> def urlopener(orig, *args, **kwargs): |
| 243 |
> opener = orig(*args, **kwargs) |
| 244 |
> opener.addheaders.append((r'X-HgTest-AuthType', r'Digest')) |
| 245 |
> return opener |
| 246 |
> EOF |
| 247 |
|
| 248 |
$ hg id http://localhost:$HGPORT2/ --config extensions.x=use_digests.py |
| 249 |
5fed3813f7f5 |
| 250 |
|
| 251 |
$ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1 |
| 252 |
streaming all changes |
| 253 |
* files to transfer, * KB of data (glob) |
| 254 |
stream-cloned * files / * KB in * seconds (*/sec) (glob) |
| 255 |
updating to branch default |
| 256 |
5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 257 |
|
| 258 |
--pull should override server's preferuncompressed |
| 259 |
$ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1 |
| 260 |
requesting all changes |
| 261 |
adding changesets |
| 262 |
adding manifests |
| 263 |
adding file changes |
| 264 |
added 2 changesets with 5 changes to 5 files |
| 265 |
new changesets 8b6053c928fe:5fed3813f7f5 |
| 266 |
updating to branch default |
| 267 |
5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 268 |
|
| 269 |
$ hg id http://user2@localhost:$HGPORT2/ |
| 270 |
abort: http authorization required for http://localhost:$HGPORT2/ |
| 271 |
[255] |
| 272 |
$ hg id http://user:pass2@localhost:$HGPORT2/ |
| 273 |
abort: HTTP Error 403: no |
| 274 |
[100] |
| 275 |
|
| 276 |
$ hg -R dest-pull tag -r tip top |
| 277 |
$ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/ |
| 278 |
pushing to http://user:***@localhost:$HGPORT2/ |
| 279 |
searching for changes |
| 280 |
remote: adding changesets |
| 281 |
remote: adding manifests |
| 282 |
remote: adding file changes |
| 283 |
remote: added 1 changesets with 1 changes to 1 files |
| 284 |
$ hg rollback -q |
| 285 |
$ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/ --debug --config devel.debug.peer-request=yes |
| 286 |
pushing to http://user:***@localhost:$HGPORT2/ |
| 287 |
using http://localhost:$HGPORT2/ |
| 288 |
http auth: user user, password **** |
| 289 |
sending capabilities command |
| 290 |
devel-peer-request: GET http://localhost:$HGPORT2/?cmd=capabilities |
| 291 |
http auth: user user, password **** |
| 292 |
devel-peer-request: finished in *.???? seconds (200) (glob) |
| 293 |
query 1; heads |
| 294 |
devel-peer-request: batched-content |
| 295 |
devel-peer-request: - heads (0 arguments) |
| 296 |
devel-peer-request: - known (1 arguments) |
| 297 |
sending batch command |
| 298 |
devel-peer-request: GET http://localhost:$HGPORT2/?cmd=batch |
| 299 |
devel-peer-request: Vary X-HgArg-1,X-HgProto-1 |
| 300 |
devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 301 |
devel-peer-request: 68 bytes of commands arguments in headers |
| 302 |
devel-peer-request: finished in *.???? seconds (200) (glob) |
| 303 |
searching for changes |
| 304 |
all remote heads known locally |
| 305 |
preparing listkeys for "phases" |
| 306 |
sending listkeys command |
| 307 |
devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys |
| 308 |
devel-peer-request: Vary X-HgArg-1,X-HgProto-1 |
| 309 |
devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 310 |
devel-peer-request: 16 bytes of commands arguments in headers |
| 311 |
devel-peer-request: finished in *.???? seconds (200) (glob) |
| 312 |
received listkey for "phases": 58 bytes |
| 313 |
checking for updated bookmarks |
| 314 |
preparing listkeys for "bookmarks" |
| 315 |
sending listkeys command |
| 316 |
devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys |
| 317 |
devel-peer-request: Vary X-HgArg-1,X-HgProto-1 |
| 318 |
devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 319 |
devel-peer-request: 19 bytes of commands arguments in headers |
| 320 |
devel-peer-request: finished in *.???? seconds (200) (glob) |
| 321 |
received listkey for "bookmarks": 0 bytes |
| 322 |
sending branchmap command |
| 323 |
devel-peer-request: GET http://localhost:$HGPORT2/?cmd=branchmap |
| 324 |
devel-peer-request: Vary X-HgProto-1 |
| 325 |
devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 326 |
devel-peer-request: finished in *.???? seconds (200) (glob) |
| 327 |
preparing listkeys for "bookmarks" |
| 328 |
sending listkeys command |
| 329 |
devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys |
| 330 |
devel-peer-request: Vary X-HgArg-1,X-HgProto-1 |
| 331 |
devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 332 |
devel-peer-request: 19 bytes of commands arguments in headers |
| 333 |
devel-peer-request: finished in *.???? seconds (200) (glob) |
| 334 |
received listkey for "bookmarks": 0 bytes |
| 335 |
1 changesets found |
| 336 |
list of changesets: |
| 337 |
7f4e523d01f2cc3765ac8934da3d14db775ff872 |
| 338 |
bundle2-output-bundle: "HG20", 5 parts total |
| 339 |
bundle2-output-part: "replycaps" * bytes payload (glob) |
| 340 |
bundle2-output-part: "check:phases" 24 bytes payload |
| 341 |
bundle2-output-part: "check:updated-heads" streamed payload |
| 342 |
bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload |
| 343 |
bundle2-output-part: "phase-heads" 24 bytes payload |
| 344 |
sending unbundle command |
| 345 |
sending * bytes (glob) |
| 346 |
devel-peer-request: POST http://localhost:$HGPORT2/?cmd=unbundle |
| 347 |
devel-peer-request: Content-length * (glob) |
| 348 |
devel-peer-request: Content-type application/mercurial-0.1 |
| 349 |
devel-peer-request: Vary X-HgArg-1,X-HgProto-1 |
| 350 |
devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 351 |
devel-peer-request: 16 bytes of commands arguments in headers |
| 352 |
devel-peer-request: * bytes of data (glob) |
| 353 |
devel-peer-request: finished in *.???? seconds (200) (glob) |
| 354 |
bundle2-input-bundle: no-transaction |
| 355 |
bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported |
| 356 |
bundle2-input-part: "output" (advisory) (params: 0 advisory) supported |
| 357 |
bundle2-input-part: total payload size 55 |
| 358 |
remote: adding changesets |
| 359 |
remote: adding manifests |
| 360 |
remote: adding file changes |
| 361 |
bundle2-input-part: "output" (advisory) supported |
| 362 |
bundle2-input-part: total payload size 45 |
| 363 |
remote: added 1 changesets with 1 changes to 1 files |
| 364 |
bundle2-input-bundle: 3 parts total |
| 365 |
preparing listkeys for "phases" |
| 366 |
sending listkeys command |
| 367 |
devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys |
| 368 |
devel-peer-request: Vary X-HgArg-1,X-HgProto-1 |
| 369 |
devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 370 |
devel-peer-request: 16 bytes of commands arguments in headers |
| 371 |
devel-peer-request: finished in *.???? seconds (200) (glob) |
| 372 |
received listkey for "phases": 15 bytes |
| 373 |
(sent 9 HTTP requests and * bytes; received * bytes in responses) (glob) (?) |
| 374 |
$ hg rollback -q |
| 375 |
|
| 376 |
$ sed 's/.*] "/"/' < ../access.log |
| 377 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 378 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 379 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 380 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 381 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 382 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 383 |
"GET /?cmd=capabilities HTTP/1.1" 200 - |
| 384 |
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 385 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 386 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 387 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 388 |
"GET /?cmd=capabilities HTTP/1.1" 200 - |
| 389 |
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 390 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 391 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 392 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 393 |
"GET /?cmd=capabilities HTTP/1.1" 200 - |
| 394 |
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 395 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 396 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 397 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 398 |
"GET /?cmd=capabilities HTTP/1.1" 200 - |
| 399 |
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 400 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 401 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 402 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 403 |
"GET /?cmd=capabilities HTTP/1.1" 200 - |
| 404 |
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 405 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 406 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 407 |
"GET /?cmd=capabilities HTTP/1.1" 401 - x-hgtest-authtype:Digest |
| 408 |
"GET /?cmd=capabilities HTTP/1.1" 200 - x-hgtest-authtype:Digest |
| 409 |
"GET /?cmd=lookup HTTP/1.1" 401 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest |
| 410 |
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest |
| 411 |
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest |
| 412 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest |
| 413 |
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest |
| 414 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest |
| 415 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 416 |
"GET /?cmd=capabilities HTTP/1.1" 200 - |
| 417 |
"GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 418 |
"GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&stream=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 419 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 420 |
"GET /?cmd=capabilities HTTP/1.1" 200 - |
| 421 |
"GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 422 |
"GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 423 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 424 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 425 |
"GET /?cmd=capabilities HTTP/1.1" 403 - |
| 426 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 427 |
"GET /?cmd=capabilities HTTP/1.1" 200 - |
| 428 |
"GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 429 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 430 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 431 |
"GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 432 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 433 |
"POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365* (glob) |
| 434 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 435 |
"GET /?cmd=capabilities HTTP/1.1" 401 - |
| 436 |
"GET /?cmd=capabilities HTTP/1.1" 200 - |
| 437 |
"GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 438 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 439 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 440 |
"GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 441 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 442 |
"POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 443 |
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
| 444 |
|
| 445 |
$ cd .. |
| 446 |
|
| 447 |
clone of serve with repo in root and unserved subrepo (issue2970) |
| 448 |
|
| 449 |
$ hg --cwd test init sub |
| 450 |
$ echo empty > test/sub/empty |
| 451 |
$ hg --cwd test/sub add empty |
| 452 |
$ hg --cwd test/sub commit -qm 'add empty' |
| 453 |
$ hg --cwd test/sub tag -r 0 something |
| 454 |
$ echo sub = sub > test/.hgsub |
| 455 |
$ hg --cwd test add .hgsub |
| 456 |
$ hg --cwd test commit -qm 'add subrepo' |
| 457 |
$ hg clone http://localhost:$HGPORT noslash-clone |
| 458 |
requesting all changes |
| 459 |
adding changesets |
| 460 |
adding manifests |
| 461 |
adding file changes |
| 462 |
added 3 changesets with 7 changes to 7 files |
| 463 |
new changesets 8b6053c928fe:56f9bc90cce6 |
| 464 |
updating to branch default |
| 465 |
cloning subrepo sub from http://localhost:$HGPORT/sub |
| 466 |
abort: HTTP Error 404: Not Found |
| 467 |
[100] |
| 468 |
$ hg clone http://localhost:$HGPORT/ slash-clone |
| 469 |
requesting all changes |
| 470 |
adding changesets |
| 471 |
adding manifests |
| 472 |
adding file changes |
| 473 |
added 3 changesets with 7 changes to 7 files |
| 474 |
new changesets 8b6053c928fe:56f9bc90cce6 |
| 475 |
updating to branch default |
| 476 |
cloning subrepo sub from http://localhost:$HGPORT/sub |
| 477 |
abort: HTTP Error 404: Not Found |
| 478 |
[100] |
| 479 |
|
| 480 |
check error log |
| 481 |
|
| 482 |
$ cat error.log |
| 483 |
|
| 484 |
$ cat errors2.log |
| 485 |
|
| 486 |
check abort error reporting while pulling/cloning |
| 487 |
|
| 488 |
$ $RUNTESTDIR/killdaemons.py |
| 489 |
$ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py |
| 490 |
$ cat hg3.pid >> $DAEMON_PIDS |
| 491 |
$ hg clone http://localhost:$HGPORT/ abort-clone |
| 492 |
requesting all changes |
| 493 |
remote: abort: this is an exercise |
| 494 |
abort: pull failed on remote |
| 495 |
[100] |
| 496 |
$ cat error.log |
| 497 |
|
| 498 |
disable pull-based clones |
| 499 |
|
| 500 |
$ hg serve -R test -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True |
| 501 |
$ cat hg4.pid >> $DAEMON_PIDS |
| 502 |
$ hg clone http://localhost:$HGPORT1/ disable-pull-clone |
| 503 |
requesting all changes |
| 504 |
remote: abort: server has pull-based clones disabled |
| 505 |
abort: pull failed on remote |
| 506 |
(remove --pull if specified or upgrade Mercurial) |
| 507 |
[100] |
| 508 |
|
| 509 |
... but keep stream clones working |
| 510 |
|
| 511 |
$ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone |
| 512 |
streaming all changes |
| 513 |
* files to transfer, * of data (glob) |
| 514 |
stream-cloned * files / * in * seconds (*/sec) (glob) |
| 515 |
$ cat error.log |
| 516 |
|
| 517 |
... and also keep partial clones and pulls working |
| 518 |
$ hg clone http://localhost:$HGPORT1 --rev 0 test/partial/clone |
| 519 |
adding changesets |
| 520 |
adding manifests |
| 521 |
adding file changes |
| 522 |
added 1 changesets with 4 changes to 4 files |
| 523 |
new changesets 8b6053c928fe |
| 524 |
updating to branch default |
| 525 |
4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 526 |
$ hg pull -R test/partial/clone |
| 527 |
pulling from http://localhost:$HGPORT1/ |
| 528 |
searching for changes |
| 529 |
adding changesets |
| 530 |
adding manifests |
| 531 |
adding file changes |
| 532 |
added 2 changesets with 3 changes to 3 files |
| 533 |
new changesets 5fed3813f7f5:56f9bc90cce6 |
| 534 |
(run 'hg update' to get a working copy) |
| 535 |
|
| 536 |
$ hg clone -U -r 0 test/partial/clone test/another/clone |
| 537 |
adding changesets |
| 538 |
adding manifests |
| 539 |
adding file changes |
| 540 |
added 1 changesets with 4 changes to 4 files |
| 541 |
new changesets 8b6053c928fe |
| 542 |
|
| 543 |
corrupt cookies file should yield a warning |
| 544 |
|
| 545 |
$ cat > $TESTTMP/cookies.txt << EOF |
| 546 |
> bad format |
| 547 |
> EOF |
| 548 |
|
| 549 |
$ hg --config auth.cookiefile=$TESTTMP/cookies.txt id http://localhost:$HGPORT/ |
| 550 |
(error loading cookie file $TESTTMP/cookies.txt: '*/cookies.txt' does not look like a Netscape format cookies file; continuing without cookies) (glob) |
| 551 |
56f9bc90cce6 |
| 552 |
|
| 553 |
$ killdaemons.py |
| 554 |
|
| 555 |
Create dummy authentication handler that looks for cookies. It doesn't do anything |
| 556 |
useful. It just raises an HTTP 500 with details about the Cookie request header. |
| 557 |
We raise HTTP 500 because its message is printed in the abort message. |
| 558 |
|
| 559 |
$ cat > cookieauth.py << EOF |
| 560 |
> from mercurial import util |
| 561 |
> from mercurial.hgweb import common |
| 562 |
> def perform_authentication(hgweb, req, op): |
| 563 |
> cookie = req.headers.get(b'Cookie') |
| 564 |
> if not cookie: |
| 565 |
> raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'no-cookie') |
| 566 |
> raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'Cookie: %s' % cookie) |
| 567 |
> def extsetup(ui): |
| 568 |
> common.permhooks.insert(0, perform_authentication) |
| 569 |
> EOF |
| 570 |
|
| 571 |
$ hg serve --config extensions.cookieauth=cookieauth.py -R test -p $HGPORT -d --pid-file=pid |
| 572 |
$ cat pid > $DAEMON_PIDS |
| 573 |
|
| 574 |
Request without cookie sent should fail due to lack of cookie |
| 575 |
|
| 576 |
$ hg id http://localhost:$HGPORT |
| 577 |
abort: HTTP Error 500: no-cookie |
| 578 |
[100] |
| 579 |
|
| 580 |
Populate a cookies file |
| 581 |
|
| 582 |
$ cat > cookies.txt << EOF |
| 583 |
> # HTTP Cookie File |
| 584 |
> # Expiration is 2030-01-01 at midnight |
| 585 |
> .example.com TRUE / FALSE 1893456000 hgkey examplevalue |
| 586 |
> EOF |
| 587 |
|
| 588 |
Should not send a cookie for another domain |
| 589 |
|
| 590 |
$ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/ |
| 591 |
abort: HTTP Error 500: no-cookie |
| 592 |
[100] |
| 593 |
|
| 594 |
Add a cookie entry for our test server and verify it is sent |
| 595 |
|
| 596 |
$ cat >> cookies.txt << EOF |
| 597 |
> localhost.local FALSE / FALSE 1893456000 hgkey localhostvalue |
| 598 |
> EOF |
| 599 |
|
| 600 |
$ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/ |
| 601 |
abort: HTTP Error 500: Cookie: hgkey=localhostvalue |
| 602 |
[100] |