| 1 |
#require no-chg |
| 2 |
|
| 3 |
persistent-nodemap is not enabled by default. It is not relevant for this test so disable it. |
| 4 |
|
| 5 |
$ cat << EOF >> $HGRCPATH |
| 6 |
> [format] |
| 7 |
> use-persistent-nodemap = no |
| 8 |
> EOF |
| 9 |
|
| 10 |
Helper function to run protocol tests against multiple protocol versions. |
| 11 |
This is easier than using #testcases because managing differences between |
| 12 |
protocols with inline conditional output is hard to read. |
| 13 |
|
| 14 |
$ debugwireproto() { |
| 15 |
> commands=`cat -` |
| 16 |
> echo 'testing ssh1' |
| 17 |
> echo "${commands}" | hg --verbose debugwireproto --localssh |
| 18 |
> } |
| 19 |
|
| 20 |
$ cat >> $HGRCPATH << EOF |
| 21 |
> [devel] |
| 22 |
> debug.peer-request = true |
| 23 |
> [extensions] |
| 24 |
> sshprotoext = $TESTDIR/sshprotoext.py |
| 25 |
> EOF |
| 26 |
|
| 27 |
$ hg init server |
| 28 |
$ cd server |
| 29 |
$ echo 0 > foo |
| 30 |
$ hg -q add foo |
| 31 |
$ hg commit -m initial |
| 32 |
|
| 33 |
A no-op connection performs a handshake |
| 34 |
|
| 35 |
$ hg debugwireproto --localssh << EOF |
| 36 |
> EOF |
| 37 |
creating ssh peer from handshake results |
| 38 |
|
| 39 |
Raw peers don't perform any activity |
| 40 |
|
| 41 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 42 |
> EOF |
| 43 |
using raw connection to peer |
| 44 |
$ hg debugwireproto --localssh --peer ssh1 << EOF |
| 45 |
> EOF |
| 46 |
creating ssh peer for wire protocol version 1 |
| 47 |
|
| 48 |
Test a normal behaving server, for sanity |
| 49 |
|
| 50 |
$ cd .. |
| 51 |
|
| 52 |
$ hg --debug debugpeer ssh://user@dummy/server |
| 53 |
running .* ".*[/\\]dummyssh" ['"]user@dummy['"] ['"]hg -R server serve --stdio['"] (re) |
| 54 |
devel-peer-request: hello+between |
| 55 |
devel-peer-request: pairs: 81 bytes |
| 56 |
sending hello command |
| 57 |
sending between command |
| 58 |
remote: \d+ (re) |
| 59 |
remote: capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) |
| 60 |
remote: 1 |
| 61 |
devel-peer-request: protocaps |
| 62 |
devel-peer-request: caps: * bytes (glob) |
| 63 |
sending protocaps command |
| 64 |
url: ssh://user@dummy/server |
| 65 |
local: no |
| 66 |
pushable: yes |
| 67 |
|
| 68 |
Server should answer the "hello" command in isolation |
| 69 |
|
| 70 |
$ hg -R server debugwireproto --localssh --peer raw << EOF |
| 71 |
> raw |
| 72 |
> hello\n |
| 73 |
> readline |
| 74 |
> readline |
| 75 |
> EOF |
| 76 |
using raw connection to peer |
| 77 |
i> write(6) -> 6: |
| 78 |
i> hello\n |
| 79 |
o> readline() -> 4: |
| 80 |
o> \d+\\n (re) |
| 81 |
o> readline\(\) -> \d+: (re) |
| 82 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 83 |
|
| 84 |
`hg debugserve --sshstdio` works |
| 85 |
|
| 86 |
$ cd server |
| 87 |
$ hg debugserve --sshstdio << EOF |
| 88 |
> hello |
| 89 |
> EOF |
| 90 |
\d+ (re) |
| 91 |
capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) |
| 92 |
|
| 93 |
I/O logging works |
| 94 |
|
| 95 |
$ hg debugserve --sshstdio --logiofd 1 << EOF |
| 96 |
> hello |
| 97 |
> EOF |
| 98 |
e> flush() -> None |
| 99 |
o> write(4) -> 4: |
| 100 |
o> \d+\\n (re) |
| 101 |
o> write\(\d+\) -> \d+: (re) |
| 102 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 103 |
\d+ (re) |
| 104 |
capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) |
| 105 |
o> flush() -> None |
| 106 |
|
| 107 |
$ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF |
| 108 |
> hello |
| 109 |
> EOF |
| 110 |
\d+ (re) |
| 111 |
capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) |
| 112 |
|
| 113 |
$ cat $TESTTMP/io |
| 114 |
e> flush() -> None |
| 115 |
o> write(4) -> 4: |
| 116 |
o> \d+\\n (re) |
| 117 |
o> write\(\d+\) -> \d+: (re) |
| 118 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 119 |
o> flush() -> None |
| 120 |
|
| 121 |
$ cd .. |
| 122 |
|
| 123 |
>=0.9.1 clients send a "hello" + "between" for the null range as part of handshake. |
| 124 |
Server should reply with capabilities and should send "1\n\n" as a successful |
| 125 |
reply with empty response to the "between". |
| 126 |
|
| 127 |
$ hg -R server debugwireproto --localssh --peer raw << EOF |
| 128 |
> raw |
| 129 |
> hello\n |
| 130 |
> readline |
| 131 |
> readline |
| 132 |
> raw |
| 133 |
> between\n |
| 134 |
> pairs 81\n |
| 135 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 136 |
> readline |
| 137 |
> readline |
| 138 |
> EOF |
| 139 |
using raw connection to peer |
| 140 |
i> write(6) -> 6: |
| 141 |
i> hello\n |
| 142 |
o> readline() -> 4: |
| 143 |
o> \d+\\n (re) |
| 144 |
o> readline\(\) -> \d+: (re) |
| 145 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 146 |
i> write(98) -> 98: |
| 147 |
i> between\n |
| 148 |
i> pairs 81\n |
| 149 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 150 |
o> readline() -> 2: |
| 151 |
o> 1\n |
| 152 |
o> readline() -> 1: |
| 153 |
o> \n |
| 154 |
|
| 155 |
SSH banner is not printed by default, ignored by clients |
| 156 |
|
| 157 |
$ SSHSERVERMODE=banner hg debugpeer ssh://user@dummy/server |
| 158 |
url: ssh://user@dummy/server |
| 159 |
local: no |
| 160 |
pushable: yes |
| 161 |
|
| 162 |
--debug will print the banner |
| 163 |
|
| 164 |
$ SSHSERVERMODE=banner hg --debug debugpeer ssh://user@dummy/server |
| 165 |
running .* ".*[/\\]dummyssh" ['"]user@dummy['"] ['"]hg -R server serve --stdio['"] (re) |
| 166 |
devel-peer-request: hello+between |
| 167 |
devel-peer-request: pairs: 81 bytes |
| 168 |
sending hello command |
| 169 |
sending between command |
| 170 |
remote: banner: line 0 |
| 171 |
remote: banner: line 1 |
| 172 |
remote: banner: line 2 |
| 173 |
remote: banner: line 3 |
| 174 |
remote: banner: line 4 |
| 175 |
remote: banner: line 5 |
| 176 |
remote: banner: line 6 |
| 177 |
remote: banner: line 7 |
| 178 |
remote: banner: line 8 |
| 179 |
remote: banner: line 9 |
| 180 |
remote: \d+ (re) |
| 181 |
remote: capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) |
| 182 |
remote: 1 |
| 183 |
devel-peer-request: protocaps |
| 184 |
devel-peer-request: caps: * bytes (glob) |
| 185 |
sending protocaps command |
| 186 |
url: ssh://user@dummy/server |
| 187 |
local: no |
| 188 |
pushable: yes |
| 189 |
|
| 190 |
And test the banner with the raw protocol |
| 191 |
|
| 192 |
$ SSHSERVERMODE=banner hg -R server debugwireproto --localssh --peer raw << EOF |
| 193 |
> raw |
| 194 |
> hello\n |
| 195 |
> readline |
| 196 |
> readline |
| 197 |
> readline |
| 198 |
> readline |
| 199 |
> readline |
| 200 |
> readline |
| 201 |
> readline |
| 202 |
> readline |
| 203 |
> readline |
| 204 |
> readline |
| 205 |
> readline |
| 206 |
> readline |
| 207 |
> raw |
| 208 |
> between\n |
| 209 |
> pairs 81\n |
| 210 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 211 |
> readline |
| 212 |
> readline |
| 213 |
> EOF |
| 214 |
using raw connection to peer |
| 215 |
i> write(6) -> 6: |
| 216 |
i> hello\n |
| 217 |
o> readline() -> 15: |
| 218 |
o> banner: line 0\n |
| 219 |
o> readline() -> 15: |
| 220 |
o> banner: line 1\n |
| 221 |
o> readline() -> 15: |
| 222 |
o> banner: line 2\n |
| 223 |
o> readline() -> 15: |
| 224 |
o> banner: line 3\n |
| 225 |
o> readline() -> 15: |
| 226 |
o> banner: line 4\n |
| 227 |
o> readline() -> 15: |
| 228 |
o> banner: line 5\n |
| 229 |
o> readline() -> 15: |
| 230 |
o> banner: line 6\n |
| 231 |
o> readline() -> 15: |
| 232 |
o> banner: line 7\n |
| 233 |
o> readline() -> 15: |
| 234 |
o> banner: line 8\n |
| 235 |
o> readline() -> 15: |
| 236 |
o> banner: line 9\n |
| 237 |
o> readline() -> 4: |
| 238 |
o> \d+\\n (re) |
| 239 |
o> readline\(\) -> \d+: (re) |
| 240 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 241 |
i> write(98) -> 98: |
| 242 |
i> between\n |
| 243 |
i> pairs 81\n |
| 244 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 245 |
o> readline() -> 2: |
| 246 |
o> 1\n |
| 247 |
o> readline() -> 1: |
| 248 |
o> \n |
| 249 |
|
| 250 |
Connecting to a <0.9.1 server that doesn't support the hello command. |
| 251 |
The client should refuse, as we dropped support for connecting to such |
| 252 |
servers. |
| 253 |
|
| 254 |
$ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server |
| 255 |
running .* ".*[/\\]dummyssh" ['"]user@dummy['"] ['"]hg -R server serve --stdio['"] (re) |
| 256 |
devel-peer-request: hello+between |
| 257 |
devel-peer-request: pairs: 81 bytes |
| 258 |
sending hello command |
| 259 |
sending between command |
| 260 |
remote: 0 |
| 261 |
remote: 1 |
| 262 |
abort: no suitable response from remote hg |
| 263 |
[255] |
| 264 |
|
| 265 |
Sending an unknown command to the server results in an empty response to that command |
| 266 |
|
| 267 |
$ hg -R server debugwireproto --localssh --peer raw << EOF |
| 268 |
> raw |
| 269 |
> pre-hello\n |
| 270 |
> readline |
| 271 |
> raw |
| 272 |
> hello\n |
| 273 |
> readline |
| 274 |
> raw |
| 275 |
> between\n |
| 276 |
> pairs 81\n |
| 277 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 278 |
> readline |
| 279 |
> readline |
| 280 |
> EOF |
| 281 |
using raw connection to peer |
| 282 |
i> write(10) -> 10: |
| 283 |
i> pre-hello\n |
| 284 |
o> readline() -> 2: |
| 285 |
o> 0\n |
| 286 |
i> write(6) -> 6: |
| 287 |
i> hello\n |
| 288 |
o> readline() -> 4: |
| 289 |
o> \d+\\n (re) |
| 290 |
i> write(98) -> 98: |
| 291 |
i> between\n |
| 292 |
i> pairs 81\n |
| 293 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 294 |
o> readline\(\) -> \d+: (re) |
| 295 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 296 |
o> readline() -> 2: |
| 297 |
o> 1\n |
| 298 |
|
| 299 |
$ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server |
| 300 |
running .* ".*[/\\]dummyssh" ['"]user@dummy['"] ['"]hg -R server serve --stdio['"] (re) |
| 301 |
sending no-args command |
| 302 |
devel-peer-request: hello+between |
| 303 |
devel-peer-request: pairs: 81 bytes |
| 304 |
sending hello command |
| 305 |
sending between command |
| 306 |
remote: 0 |
| 307 |
remote: \d+ (re) |
| 308 |
remote: capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) |
| 309 |
remote: 1 |
| 310 |
devel-peer-request: protocaps |
| 311 |
devel-peer-request: caps: * bytes (glob) |
| 312 |
sending protocaps command |
| 313 |
url: ssh://user@dummy/server |
| 314 |
local: no |
| 315 |
pushable: yes |
| 316 |
|
| 317 |
Send multiple unknown commands before hello |
| 318 |
|
| 319 |
$ hg -R server debugwireproto --localssh --peer raw << EOF |
| 320 |
> raw |
| 321 |
> unknown1\n |
| 322 |
> readline |
| 323 |
> raw |
| 324 |
> unknown2\n |
| 325 |
> readline |
| 326 |
> raw |
| 327 |
> unknown3\n |
| 328 |
> readline |
| 329 |
> raw |
| 330 |
> hello\n |
| 331 |
> readline |
| 332 |
> readline |
| 333 |
> raw |
| 334 |
> between\n |
| 335 |
> pairs 81\n |
| 336 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 337 |
> readline |
| 338 |
> readline |
| 339 |
> EOF |
| 340 |
using raw connection to peer |
| 341 |
i> write(9) -> 9: |
| 342 |
i> unknown1\n |
| 343 |
o> readline() -> 2: |
| 344 |
o> 0\n |
| 345 |
i> write(9) -> 9: |
| 346 |
i> unknown2\n |
| 347 |
o> readline() -> 2: |
| 348 |
o> 0\n |
| 349 |
i> write(9) -> 9: |
| 350 |
i> unknown3\n |
| 351 |
o> readline() -> 2: |
| 352 |
o> 0\n |
| 353 |
i> write(6) -> 6: |
| 354 |
i> hello\n |
| 355 |
o> readline() -> 4: |
| 356 |
o> \d+\\n (re) |
| 357 |
o> readline\(\) -> \d+: (re) |
| 358 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 359 |
i> write(98) -> 98: |
| 360 |
i> between\n |
| 361 |
i> pairs 81\n |
| 362 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 363 |
o> readline() -> 2: |
| 364 |
o> 1\n |
| 365 |
o> readline() -> 1: |
| 366 |
o> \n |
| 367 |
|
| 368 |
$ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server |
| 369 |
running .* ".*[/\\]dummyssh" ['"]user@dummy['"] ['"]hg -R server serve --stdio['"] (re) |
| 370 |
sending unknown1 command |
| 371 |
sending unknown2 command |
| 372 |
sending unknown3 command |
| 373 |
devel-peer-request: hello+between |
| 374 |
devel-peer-request: pairs: 81 bytes |
| 375 |
sending hello command |
| 376 |
sending between command |
| 377 |
remote: 0 |
| 378 |
remote: 0 |
| 379 |
remote: 0 |
| 380 |
remote: \d+ (re) |
| 381 |
remote: capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) |
| 382 |
remote: 1 |
| 383 |
devel-peer-request: protocaps |
| 384 |
devel-peer-request: caps: * bytes (glob) |
| 385 |
sending protocaps command |
| 386 |
url: ssh://user@dummy/server |
| 387 |
local: no |
| 388 |
pushable: yes |
| 389 |
|
| 390 |
Send an unknown command before hello that has arguments |
| 391 |
|
| 392 |
$ cd server |
| 393 |
|
| 394 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 395 |
> raw |
| 396 |
> with-args\n |
| 397 |
> foo 13\n |
| 398 |
> value for foo\n |
| 399 |
> bar 13\n |
| 400 |
> value for bar\n |
| 401 |
> readline |
| 402 |
> readline |
| 403 |
> readline |
| 404 |
> readline |
| 405 |
> readline |
| 406 |
> raw |
| 407 |
> hello\n |
| 408 |
> readline |
| 409 |
> readline |
| 410 |
> raw |
| 411 |
> between\n |
| 412 |
> pairs 81\n |
| 413 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 414 |
> readline |
| 415 |
> readline |
| 416 |
> EOF |
| 417 |
using raw connection to peer |
| 418 |
i> write(52) -> 52: |
| 419 |
i> with-args\n |
| 420 |
i> foo 13\n |
| 421 |
i> value for foo\n |
| 422 |
i> bar 13\n |
| 423 |
i> value for bar\n |
| 424 |
o> readline() -> 2: |
| 425 |
o> 0\n |
| 426 |
o> readline() -> 2: |
| 427 |
o> 0\n |
| 428 |
o> readline() -> 2: |
| 429 |
o> 0\n |
| 430 |
o> readline() -> 2: |
| 431 |
o> 0\n |
| 432 |
o> readline() -> 2: |
| 433 |
o> 0\n |
| 434 |
i> write(6) -> 6: |
| 435 |
i> hello\n |
| 436 |
o> readline() -> 4: |
| 437 |
o> \d+\\n (re) |
| 438 |
o> readline\(\) -> \d+: (re) |
| 439 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 440 |
i> write(98) -> 98: |
| 441 |
i> between\n |
| 442 |
i> pairs 81\n |
| 443 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 444 |
o> readline() -> 2: |
| 445 |
o> 1\n |
| 446 |
o> readline() -> 1: |
| 447 |
o> \n |
| 448 |
|
| 449 |
Send an unknown command having an argument that looks numeric |
| 450 |
|
| 451 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 452 |
> raw |
| 453 |
> unknown\n |
| 454 |
> foo 1\n |
| 455 |
> 0\n |
| 456 |
> readline |
| 457 |
> readline |
| 458 |
> readline |
| 459 |
> raw |
| 460 |
> hello\n |
| 461 |
> readline |
| 462 |
> readline |
| 463 |
> raw |
| 464 |
> between\n |
| 465 |
> pairs 81\n |
| 466 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 467 |
> readline |
| 468 |
> readline |
| 469 |
> EOF |
| 470 |
using raw connection to peer |
| 471 |
i> write(16) -> 16: |
| 472 |
i> unknown\n |
| 473 |
i> foo 1\n |
| 474 |
i> 0\n |
| 475 |
o> readline() -> 2: |
| 476 |
o> 0\n |
| 477 |
o> readline() -> 2: |
| 478 |
o> 0\n |
| 479 |
o> readline() -> 2: |
| 480 |
o> 0\n |
| 481 |
i> write(6) -> 6: |
| 482 |
i> hello\n |
| 483 |
o> readline() -> 4: |
| 484 |
o> \d+\\n (re) |
| 485 |
o> readline\(\) -> \d+: (re) |
| 486 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 487 |
i> write(98) -> 98: |
| 488 |
i> between\n |
| 489 |
i> pairs 81\n |
| 490 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 491 |
o> readline() -> 2: |
| 492 |
o> 1\n |
| 493 |
o> readline() -> 1: |
| 494 |
o> \n |
| 495 |
|
| 496 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 497 |
> raw |
| 498 |
> unknown\n |
| 499 |
> foo 1\n |
| 500 |
> 1\n |
| 501 |
> readline |
| 502 |
> readline |
| 503 |
> readline |
| 504 |
> raw |
| 505 |
> hello\n |
| 506 |
> readline |
| 507 |
> readline |
| 508 |
> raw |
| 509 |
> between\n |
| 510 |
> pairs 81\n |
| 511 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 512 |
> readline |
| 513 |
> readline |
| 514 |
> EOF |
| 515 |
using raw connection to peer |
| 516 |
i> write(16) -> 16: |
| 517 |
i> unknown\n |
| 518 |
i> foo 1\n |
| 519 |
i> 1\n |
| 520 |
o> readline() -> 2: |
| 521 |
o> 0\n |
| 522 |
o> readline() -> 2: |
| 523 |
o> 0\n |
| 524 |
o> readline() -> 2: |
| 525 |
o> 0\n |
| 526 |
i> write(6) -> 6: |
| 527 |
i> hello\n |
| 528 |
o> readline() -> 4: |
| 529 |
o> \d+\\n (re) |
| 530 |
o> readline\(\) -> \d+: (re) |
| 531 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 532 |
i> write(98) -> 98: |
| 533 |
i> between\n |
| 534 |
i> pairs 81\n |
| 535 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 536 |
o> readline() -> 2: |
| 537 |
o> 1\n |
| 538 |
o> readline() -> 1: |
| 539 |
o> \n |
| 540 |
|
| 541 |
When sending a dict argument value, it is serialized to |
| 542 |
"<arg> <item count>" followed by "<key> <len>\n<value>" for each item |
| 543 |
in the dict. |
| 544 |
|
| 545 |
Dictionary value for unknown command |
| 546 |
|
| 547 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 548 |
> raw |
| 549 |
> unknown\n |
| 550 |
> dict 3\n |
| 551 |
> key1 3\n |
| 552 |
> foo\n |
| 553 |
> key2 3\n |
| 554 |
> bar\n |
| 555 |
> key3 3\n |
| 556 |
> baz\n |
| 557 |
> readline |
| 558 |
> readline |
| 559 |
> readline |
| 560 |
> readline |
| 561 |
> readline |
| 562 |
> readline |
| 563 |
> readline |
| 564 |
> readline |
| 565 |
> raw |
| 566 |
> hello\n |
| 567 |
> readline |
| 568 |
> readline |
| 569 |
> EOF |
| 570 |
using raw connection to peer |
| 571 |
i> write(48) -> 48: |
| 572 |
i> unknown\n |
| 573 |
i> dict 3\n |
| 574 |
i> key1 3\n |
| 575 |
i> foo\n |
| 576 |
i> key2 3\n |
| 577 |
i> bar\n |
| 578 |
i> key3 3\n |
| 579 |
i> baz\n |
| 580 |
o> readline() -> 2: |
| 581 |
o> 0\n |
| 582 |
o> readline() -> 2: |
| 583 |
o> 0\n |
| 584 |
o> readline() -> 2: |
| 585 |
o> 0\n |
| 586 |
o> readline() -> 2: |
| 587 |
o> 0\n |
| 588 |
o> readline() -> 2: |
| 589 |
o> 0\n |
| 590 |
o> readline() -> 2: |
| 591 |
o> 0\n |
| 592 |
o> readline() -> 2: |
| 593 |
o> 0\n |
| 594 |
o> readline() -> 2: |
| 595 |
o> 0\n |
| 596 |
i> write(6) -> 6: |
| 597 |
i> hello\n |
| 598 |
o> readline() -> 4: |
| 599 |
o> \d+\\n (re) |
| 600 |
o> readline\(\) -> \d+: (re) |
| 601 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 602 |
|
| 603 |
Incomplete dictionary send |
| 604 |
|
| 605 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 606 |
> raw |
| 607 |
> unknown\n |
| 608 |
> dict 3\n |
| 609 |
> key1 3\n |
| 610 |
> foo\n |
| 611 |
> readline |
| 612 |
> readline |
| 613 |
> readline |
| 614 |
> readline |
| 615 |
> EOF |
| 616 |
using raw connection to peer |
| 617 |
i> write(26) -> 26: |
| 618 |
i> unknown\n |
| 619 |
i> dict 3\n |
| 620 |
i> key1 3\n |
| 621 |
i> foo\n |
| 622 |
o> readline() -> 2: |
| 623 |
o> 0\n |
| 624 |
o> readline() -> 2: |
| 625 |
o> 0\n |
| 626 |
o> readline() -> 2: |
| 627 |
o> 0\n |
| 628 |
o> readline() -> 2: |
| 629 |
o> 0\n |
| 630 |
|
| 631 |
Incomplete value send |
| 632 |
|
| 633 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 634 |
> raw |
| 635 |
> unknown\n |
| 636 |
> dict 3\n |
| 637 |
> key1 3\n |
| 638 |
> fo |
| 639 |
> readline |
| 640 |
> readline |
| 641 |
> readline |
| 642 |
> EOF |
| 643 |
using raw connection to peer |
| 644 |
i> write(24) -> 24: |
| 645 |
i> unknown\n |
| 646 |
i> dict 3\n |
| 647 |
i> key1 3\n |
| 648 |
i> fo |
| 649 |
o> readline() -> 2: |
| 650 |
o> 0\n |
| 651 |
o> readline() -> 2: |
| 652 |
o> 0\n |
| 653 |
o> readline() -> 2: |
| 654 |
o> 0\n |
| 655 |
|
| 656 |
Send a command line with spaces |
| 657 |
|
| 658 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 659 |
> raw |
| 660 |
> unknown withspace\n |
| 661 |
> readline |
| 662 |
> raw |
| 663 |
> hello\n |
| 664 |
> readline |
| 665 |
> readline |
| 666 |
> raw |
| 667 |
> between\n |
| 668 |
> pairs 81\n |
| 669 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 670 |
> readline |
| 671 |
> readline |
| 672 |
> EOF |
| 673 |
using raw connection to peer |
| 674 |
i> write(18) -> 18: |
| 675 |
i> unknown withspace\n |
| 676 |
o> readline() -> 2: |
| 677 |
o> 0\n |
| 678 |
i> write(6) -> 6: |
| 679 |
i> hello\n |
| 680 |
o> readline() -> 4: |
| 681 |
o> \d+\\n (re) |
| 682 |
o> readline\(\) -> \d+: (re) |
| 683 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 684 |
i> write(98) -> 98: |
| 685 |
i> between\n |
| 686 |
i> pairs 81\n |
| 687 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 688 |
o> readline() -> 2: |
| 689 |
o> 1\n |
| 690 |
o> readline() -> 1: |
| 691 |
o> \n |
| 692 |
|
| 693 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 694 |
> raw |
| 695 |
> unknown with multiple spaces\n |
| 696 |
> readline |
| 697 |
> raw |
| 698 |
> hello\n |
| 699 |
> readline |
| 700 |
> readline |
| 701 |
> raw |
| 702 |
> between\n |
| 703 |
> pairs 81\n |
| 704 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 705 |
> readline |
| 706 |
> EOF |
| 707 |
using raw connection to peer |
| 708 |
i> write(29) -> 29: |
| 709 |
i> unknown with multiple spaces\n |
| 710 |
o> readline() -> 2: |
| 711 |
o> 0\n |
| 712 |
i> write(6) -> 6: |
| 713 |
i> hello\n |
| 714 |
o> readline() -> 4: |
| 715 |
o> \d+\\n (re) |
| 716 |
o> readline\(\) -> \d+: (re) |
| 717 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 718 |
i> write(98) -> 98: |
| 719 |
i> between\n |
| 720 |
i> pairs 81\n |
| 721 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 722 |
o> readline() -> 2: |
| 723 |
o> 1\n |
| 724 |
|
| 725 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 726 |
> raw |
| 727 |
> unknown with spaces\n |
| 728 |
> key 10\n |
| 729 |
> some value\n |
| 730 |
> readline |
| 731 |
> readline |
| 732 |
> readline |
| 733 |
> raw |
| 734 |
> hello\n |
| 735 |
> readline |
| 736 |
> readline |
| 737 |
> raw |
| 738 |
> between\n |
| 739 |
> pairs 81\n |
| 740 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 741 |
> readline |
| 742 |
> readline |
| 743 |
> EOF |
| 744 |
using raw connection to peer |
| 745 |
i> write(38) -> 38: |
| 746 |
i> unknown with spaces\n |
| 747 |
i> key 10\n |
| 748 |
i> some value\n |
| 749 |
o> readline() -> 2: |
| 750 |
o> 0\n |
| 751 |
o> readline() -> 2: |
| 752 |
o> 0\n |
| 753 |
o> readline() -> 2: |
| 754 |
o> 0\n |
| 755 |
i> write(6) -> 6: |
| 756 |
i> hello\n |
| 757 |
o> readline() -> 4: |
| 758 |
o> \d+\\n (re) |
| 759 |
o> readline\(\) -> \d+: (re) |
| 760 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 761 |
i> write(98) -> 98: |
| 762 |
i> between\n |
| 763 |
i> pairs 81\n |
| 764 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 765 |
o> readline() -> 2: |
| 766 |
o> 1\n |
| 767 |
o> readline() -> 1: |
| 768 |
o> \n |
| 769 |
Send an unknown command after the "between" |
| 770 |
|
| 771 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 772 |
> raw |
| 773 |
> hello\n |
| 774 |
> readline |
| 775 |
> readline |
| 776 |
> raw |
| 777 |
> between\n |
| 778 |
> pairs 81\n |
| 779 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown |
| 780 |
> readline |
| 781 |
> readline |
| 782 |
> EOF |
| 783 |
using raw connection to peer |
| 784 |
i> write(6) -> 6: |
| 785 |
i> hello\n |
| 786 |
o> readline() -> 4: |
| 787 |
o> \d+\\n (re) |
| 788 |
o> readline\(\) -> \d+: (re) |
| 789 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 790 |
i> write(105) -> 105: |
| 791 |
i> between\n |
| 792 |
i> pairs 81\n |
| 793 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown |
| 794 |
o> readline() -> 2: |
| 795 |
o> 1\n |
| 796 |
o> readline() -> 1: |
| 797 |
o> \n |
| 798 |
|
| 799 |
And one with arguments |
| 800 |
|
| 801 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 802 |
> raw |
| 803 |
> hello\n |
| 804 |
> between\n |
| 805 |
> pairs 81\n |
| 806 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 807 |
> readline |
| 808 |
> readline |
| 809 |
> readline |
| 810 |
> readline |
| 811 |
> raw |
| 812 |
> unknown\n |
| 813 |
> foo 5\n |
| 814 |
> \nvalue\n |
| 815 |
> bar 3\n |
| 816 |
> baz\n |
| 817 |
> readline |
| 818 |
> readline |
| 819 |
> readline |
| 820 |
> EOF |
| 821 |
using raw connection to peer |
| 822 |
i> write(104) -> 104: |
| 823 |
i> hello\n |
| 824 |
i> between\n |
| 825 |
i> pairs 81\n |
| 826 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 827 |
o> readline() -> 4: |
| 828 |
o> \d+\\n (re) |
| 829 |
o> readline\(\) -> \d+: (re) |
| 830 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 831 |
o> readline() -> 2: |
| 832 |
o> 1\n |
| 833 |
o> readline() -> 1: |
| 834 |
o> \n |
| 835 |
i> write(31) -> 31: |
| 836 |
i> unknown\n |
| 837 |
i> foo 5\n |
| 838 |
i> \n |
| 839 |
i> value\n |
| 840 |
i> bar 3\n |
| 841 |
i> baz\n |
| 842 |
o> readline() -> 2: |
| 843 |
o> 0\n |
| 844 |
o> readline() -> 2: |
| 845 |
o> 0\n |
| 846 |
o> readline() -> 0: |
| 847 |
|
| 848 |
Send a valid command before the handshake |
| 849 |
|
| 850 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 851 |
> raw |
| 852 |
> heads\n |
| 853 |
> readline |
| 854 |
> raw |
| 855 |
> hello\n |
| 856 |
> between\n |
| 857 |
> pairs 81\n |
| 858 |
> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 859 |
> readline |
| 860 |
> readline |
| 861 |
> readline |
| 862 |
> readline |
| 863 |
> EOF |
| 864 |
using raw connection to peer |
| 865 |
i> write(6) -> 6: |
| 866 |
i> heads\n |
| 867 |
o> readline() -> 3: |
| 868 |
o> 41\n |
| 869 |
i> write(104) -> 104: |
| 870 |
i> hello\n |
| 871 |
i> between\n |
| 872 |
i> pairs 81\n |
| 873 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 874 |
o> readline() -> 41: |
| 875 |
o> 68986213bd4485ea51533535e3fc9e78007a711f\n |
| 876 |
o> readline() -> 4: |
| 877 |
o> \d+\\n (re) |
| 878 |
o> readline\(\) -> \d+: (re) |
| 879 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 880 |
o> readline() -> 2: |
| 881 |
o> 1\n |
| 882 |
|
| 883 |
And a variation that doesn't send the between command |
| 884 |
|
| 885 |
$ hg debugwireproto --localssh --peer raw << EOF |
| 886 |
> raw |
| 887 |
> heads\n |
| 888 |
> readline |
| 889 |
> raw |
| 890 |
> hello\n |
| 891 |
> readline |
| 892 |
> readline |
| 893 |
> EOF |
| 894 |
using raw connection to peer |
| 895 |
i> write(6) -> 6: |
| 896 |
i> heads\n |
| 897 |
o> readline() -> 3: |
| 898 |
o> 41\n |
| 899 |
i> write(6) -> 6: |
| 900 |
i> hello\n |
| 901 |
o> readline() -> 41: |
| 902 |
o> 68986213bd4485ea51533535e3fc9e78007a711f\n |
| 903 |
o> readline() -> 4: |
| 904 |
o> \d+\\n (re) |
| 905 |
|
| 906 |
$ cd .. |
| 907 |
|
| 908 |
Test listkeys for listing namespaces |
| 909 |
|
| 910 |
$ hg init empty |
| 911 |
$ cd empty |
| 912 |
$ debugwireproto << EOF |
| 913 |
> command listkeys |
| 914 |
> namespace namespaces |
| 915 |
> EOF |
| 916 |
testing ssh1 |
| 917 |
creating ssh peer from handshake results |
| 918 |
i> write(104) -> 104: |
| 919 |
i> hello\n |
| 920 |
i> between\n |
| 921 |
i> pairs 81\n |
| 922 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 923 |
i> flush() -> None |
| 924 |
o> readline() -> 4: |
| 925 |
o> \d+\\n (re) |
| 926 |
o> readline\(\) -> \d+: (re) |
| 927 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 928 |
o> readline() -> 2: |
| 929 |
o> 1\n |
| 930 |
o> readline() -> 1: |
| 931 |
o> \n |
| 932 |
sending listkeys command |
| 933 |
i> write(9) -> 9: |
| 934 |
i> listkeys\n |
| 935 |
i> write(13) -> 13: |
| 936 |
i> namespace 10\n |
| 937 |
i> write(10) -> 10: namespaces |
| 938 |
i> flush() -> None |
| 939 |
o> bufferedreadline() -> 3: |
| 940 |
o> 30\n |
| 941 |
o> bufferedread(30) -> 30: |
| 942 |
o> bookmarks\t\n |
| 943 |
o> namespaces\t\n |
| 944 |
o> phases\t |
| 945 |
response: { |
| 946 |
b'bookmarks': b'', |
| 947 |
b'namespaces': b'', |
| 948 |
b'phases': b'' |
| 949 |
} |
| 950 |
|
| 951 |
$ cd .. |
| 952 |
|
| 953 |
Test listkeys for bookmarks |
| 954 |
|
| 955 |
$ hg init bookmarkrepo |
| 956 |
$ cd bookmarkrepo |
| 957 |
$ echo 0 > foo |
| 958 |
$ hg add foo |
| 959 |
$ hg -q commit -m initial |
| 960 |
$ echo 1 > foo |
| 961 |
$ hg commit -m second |
| 962 |
|
| 963 |
With no bookmarks set |
| 964 |
|
| 965 |
$ debugwireproto << EOF |
| 966 |
> command listkeys |
| 967 |
> namespace bookmarks |
| 968 |
> EOF |
| 969 |
testing ssh1 |
| 970 |
creating ssh peer from handshake results |
| 971 |
i> write(104) -> 104: |
| 972 |
i> hello\n |
| 973 |
i> between\n |
| 974 |
i> pairs 81\n |
| 975 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 976 |
i> flush() -> None |
| 977 |
o> readline() -> 4: |
| 978 |
o> \d+\\n (re) |
| 979 |
o> readline\(\) -> \d+: (re) |
| 980 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 981 |
o> readline() -> 2: |
| 982 |
o> 1\n |
| 983 |
o> readline() -> 1: |
| 984 |
o> \n |
| 985 |
sending listkeys command |
| 986 |
i> write(9) -> 9: |
| 987 |
i> listkeys\n |
| 988 |
i> write(12) -> 12: |
| 989 |
i> namespace 9\n |
| 990 |
i> write(9) -> 9: bookmarks |
| 991 |
i> flush() -> None |
| 992 |
o> bufferedreadline() -> 2: |
| 993 |
o> 0\n |
| 994 |
response: {} |
| 995 |
|
| 996 |
With a single bookmark set |
| 997 |
|
| 998 |
$ hg book -r 0 bookA |
| 999 |
$ debugwireproto << EOF |
| 1000 |
> command listkeys |
| 1001 |
> namespace bookmarks |
| 1002 |
> EOF |
| 1003 |
testing ssh1 |
| 1004 |
creating ssh peer from handshake results |
| 1005 |
i> write(104) -> 104: |
| 1006 |
i> hello\n |
| 1007 |
i> between\n |
| 1008 |
i> pairs 81\n |
| 1009 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 1010 |
i> flush() -> None |
| 1011 |
o> readline() -> 4: |
| 1012 |
o> \d+\\n (re) |
| 1013 |
o> readline\(\) -> \d+: (re) |
| 1014 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 1015 |
o> readline() -> 2: |
| 1016 |
o> 1\n |
| 1017 |
o> readline() -> 1: |
| 1018 |
o> \n |
| 1019 |
sending listkeys command |
| 1020 |
i> write(9) -> 9: |
| 1021 |
i> listkeys\n |
| 1022 |
i> write(12) -> 12: |
| 1023 |
i> namespace 9\n |
| 1024 |
i> write(9) -> 9: bookmarks |
| 1025 |
i> flush() -> None |
| 1026 |
o> bufferedreadline() -> 3: |
| 1027 |
o> 46\n |
| 1028 |
o> bufferedread(46) -> 46: bookA\t68986213bd4485ea51533535e3fc9e78007a711f |
| 1029 |
response: { |
| 1030 |
b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f' |
| 1031 |
} |
| 1032 |
|
| 1033 |
With multiple bookmarks set |
| 1034 |
|
| 1035 |
$ hg book -r 1 bookB |
| 1036 |
$ debugwireproto << EOF |
| 1037 |
> command listkeys |
| 1038 |
> namespace bookmarks |
| 1039 |
> EOF |
| 1040 |
testing ssh1 |
| 1041 |
creating ssh peer from handshake results |
| 1042 |
i> write(104) -> 104: |
| 1043 |
i> hello\n |
| 1044 |
i> between\n |
| 1045 |
i> pairs 81\n |
| 1046 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 1047 |
i> flush() -> None |
| 1048 |
o> readline() -> 4: |
| 1049 |
o> \d+\\n (re) |
| 1050 |
o> readline\(\) -> \d+: (re) |
| 1051 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 1052 |
o> readline() -> 2: |
| 1053 |
o> 1\n |
| 1054 |
o> readline() -> 1: |
| 1055 |
o> \n |
| 1056 |
sending listkeys command |
| 1057 |
i> write(9) -> 9: |
| 1058 |
i> listkeys\n |
| 1059 |
i> write(12) -> 12: |
| 1060 |
i> namespace 9\n |
| 1061 |
i> write(9) -> 9: bookmarks |
| 1062 |
i> flush() -> None |
| 1063 |
o> bufferedreadline() -> 3: |
| 1064 |
o> 93\n |
| 1065 |
o> bufferedread(93) -> 93: |
| 1066 |
o> bookA\t68986213bd4485ea51533535e3fc9e78007a711f\n |
| 1067 |
o> bookB\t1880f3755e2e52e3199e0ee5638128b08642f34d |
| 1068 |
response: { |
| 1069 |
b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f', |
| 1070 |
b'bookB': b'1880f3755e2e52e3199e0ee5638128b08642f34d' |
| 1071 |
} |
| 1072 |
|
| 1073 |
Test pushkey for bookmarks |
| 1074 |
|
| 1075 |
$ debugwireproto << EOF |
| 1076 |
> command pushkey |
| 1077 |
> namespace bookmarks |
| 1078 |
> key remote |
| 1079 |
> old |
| 1080 |
> new 68986213bd4485ea51533535e3fc9e78007a711f |
| 1081 |
> EOF |
| 1082 |
testing ssh1 |
| 1083 |
creating ssh peer from handshake results |
| 1084 |
i> write(104) -> 104: |
| 1085 |
i> hello\n |
| 1086 |
i> between\n |
| 1087 |
i> pairs 81\n |
| 1088 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 1089 |
i> flush() -> None |
| 1090 |
o> readline() -> 4: |
| 1091 |
o> \d+\\n (re) |
| 1092 |
o> readline\(\) -> \d+: (re) |
| 1093 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 1094 |
o> readline() -> 2: |
| 1095 |
o> 1\n |
| 1096 |
o> readline() -> 1: |
| 1097 |
o> \n |
| 1098 |
sending pushkey command |
| 1099 |
i> write(8) -> 8: |
| 1100 |
i> pushkey\n |
| 1101 |
i> write(6) -> 6: |
| 1102 |
i> key 6\n |
| 1103 |
i> write(6) -> 6: remote |
| 1104 |
i> write(12) -> 12: |
| 1105 |
i> namespace 9\n |
| 1106 |
i> write(9) -> 9: bookmarks |
| 1107 |
i> write(7) -> 7: |
| 1108 |
i> new 40\n |
| 1109 |
i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f |
| 1110 |
i> write(6) -> 6: |
| 1111 |
i> old 0\n |
| 1112 |
i> flush() -> None |
| 1113 |
o> bufferedreadline() -> 2: |
| 1114 |
o> 2\n |
| 1115 |
o> bufferedread(2) -> 2: |
| 1116 |
o> 1\n |
| 1117 |
response: True |
| 1118 |
|
| 1119 |
$ hg bookmarks |
| 1120 |
bookA 0:68986213bd44 |
| 1121 |
bookB 1:1880f3755e2e |
| 1122 |
remote 0:68986213bd44 |
| 1123 |
|
| 1124 |
$ cd .. |
| 1125 |
|
| 1126 |
Test listkeys for phases |
| 1127 |
|
| 1128 |
$ hg init phasesrepo |
| 1129 |
$ cd phasesrepo |
| 1130 |
|
| 1131 |
Phases on empty repo |
| 1132 |
|
| 1133 |
$ debugwireproto << EOF |
| 1134 |
> command listkeys |
| 1135 |
> namespace phases |
| 1136 |
> EOF |
| 1137 |
testing ssh1 |
| 1138 |
creating ssh peer from handshake results |
| 1139 |
i> write(104) -> 104: |
| 1140 |
i> hello\n |
| 1141 |
i> between\n |
| 1142 |
i> pairs 81\n |
| 1143 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 1144 |
i> flush() -> None |
| 1145 |
o> readline() -> 4: |
| 1146 |
o> \d+\\n (re) |
| 1147 |
o> readline\(\) -> \d+: (re) |
| 1148 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 1149 |
o> readline() -> 2: |
| 1150 |
o> 1\n |
| 1151 |
o> readline() -> 1: |
| 1152 |
o> \n |
| 1153 |
sending listkeys command |
| 1154 |
i> write(9) -> 9: |
| 1155 |
i> listkeys\n |
| 1156 |
i> write(12) -> 12: |
| 1157 |
i> namespace 6\n |
| 1158 |
i> write(6) -> 6: phases |
| 1159 |
i> flush() -> None |
| 1160 |
o> bufferedreadline() -> 3: |
| 1161 |
o> 15\n |
| 1162 |
o> bufferedread(15) -> 15: publishing\tTrue |
| 1163 |
response: { |
| 1164 |
b'publishing': b'True' |
| 1165 |
} |
| 1166 |
|
| 1167 |
Create some commits |
| 1168 |
|
| 1169 |
$ echo 0 > foo |
| 1170 |
$ hg add foo |
| 1171 |
$ hg -q commit -m initial |
| 1172 |
$ hg phase --public |
| 1173 |
$ echo 1 > foo |
| 1174 |
$ hg commit -m 'head 1 commit 1' |
| 1175 |
$ echo 2 > foo |
| 1176 |
$ hg commit -m 'head 1 commit 2' |
| 1177 |
$ hg -q up 0 |
| 1178 |
$ echo 1a > foo |
| 1179 |
$ hg commit -m 'head 2 commit 1' |
| 1180 |
created new head |
| 1181 |
$ echo 2a > foo |
| 1182 |
$ hg commit -m 'head 2 commit 2' |
| 1183 |
|
| 1184 |
Two draft heads |
| 1185 |
|
| 1186 |
$ debugwireproto << EOF |
| 1187 |
> command listkeys |
| 1188 |
> namespace phases |
| 1189 |
> EOF |
| 1190 |
testing ssh1 |
| 1191 |
creating ssh peer from handshake results |
| 1192 |
i> write(104) -> 104: |
| 1193 |
i> hello\n |
| 1194 |
i> between\n |
| 1195 |
i> pairs 81\n |
| 1196 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 1197 |
i> flush() -> None |
| 1198 |
o> readline() -> 4: |
| 1199 |
o> \d+\\n (re) |
| 1200 |
o> readline\(\) -> \d+: (re) |
| 1201 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 1202 |
o> readline() -> 2: |
| 1203 |
o> 1\n |
| 1204 |
o> readline() -> 1: |
| 1205 |
o> \n |
| 1206 |
sending listkeys command |
| 1207 |
i> write(9) -> 9: |
| 1208 |
i> listkeys\n |
| 1209 |
i> write(12) -> 12: |
| 1210 |
i> namespace 6\n |
| 1211 |
i> write(6) -> 6: phases |
| 1212 |
i> flush() -> None |
| 1213 |
o> bufferedreadline() -> 4: |
| 1214 |
o> 101\n |
| 1215 |
o> bufferedread(101) -> 101: |
| 1216 |
o> 20b8a89289d80036e6c4e87c2083e3bea1586637\t1\n |
| 1217 |
o> c4750011d906c18ea2f0527419cbc1a544435150\t1\n |
| 1218 |
o> publishing\tTrue |
| 1219 |
response: { |
| 1220 |
b'20b8a89289d80036e6c4e87c2083e3bea1586637': b'1', |
| 1221 |
b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', |
| 1222 |
b'publishing': b'True' |
| 1223 |
} |
| 1224 |
|
| 1225 |
Single draft head |
| 1226 |
|
| 1227 |
$ hg phase --public -r 2 |
| 1228 |
$ debugwireproto << EOF |
| 1229 |
> command listkeys |
| 1230 |
> namespace phases |
| 1231 |
> EOF |
| 1232 |
testing ssh1 |
| 1233 |
creating ssh peer from handshake results |
| 1234 |
i> write(104) -> 104: |
| 1235 |
i> hello\n |
| 1236 |
i> between\n |
| 1237 |
i> pairs 81\n |
| 1238 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 1239 |
i> flush() -> None |
| 1240 |
o> readline() -> 4: |
| 1241 |
o> \d+\\n (re) |
| 1242 |
o> readline\(\) -> \d+: (re) |
| 1243 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 1244 |
o> readline() -> 2: |
| 1245 |
o> 1\n |
| 1246 |
o> readline() -> 1: |
| 1247 |
o> \n |
| 1248 |
sending listkeys command |
| 1249 |
i> write(9) -> 9: |
| 1250 |
i> listkeys\n |
| 1251 |
i> write(12) -> 12: |
| 1252 |
i> namespace 6\n |
| 1253 |
i> write(6) -> 6: phases |
| 1254 |
i> flush() -> None |
| 1255 |
o> bufferedreadline() -> 3: |
| 1256 |
o> 58\n |
| 1257 |
o> bufferedread(58) -> 58: |
| 1258 |
o> c4750011d906c18ea2f0527419cbc1a544435150\t1\n |
| 1259 |
o> publishing\tTrue |
| 1260 |
response: { |
| 1261 |
b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', |
| 1262 |
b'publishing': b'True' |
| 1263 |
} |
| 1264 |
|
| 1265 |
All public heads |
| 1266 |
|
| 1267 |
$ hg phase --public -r 4 |
| 1268 |
$ debugwireproto << EOF |
| 1269 |
> command listkeys |
| 1270 |
> namespace phases |
| 1271 |
> EOF |
| 1272 |
testing ssh1 |
| 1273 |
creating ssh peer from handshake results |
| 1274 |
i> write(104) -> 104: |
| 1275 |
i> hello\n |
| 1276 |
i> between\n |
| 1277 |
i> pairs 81\n |
| 1278 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 1279 |
i> flush() -> None |
| 1280 |
o> readline() -> 4: |
| 1281 |
o> \d+\\n (re) |
| 1282 |
o> readline\(\) -> \d+: (re) |
| 1283 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 1284 |
o> readline() -> 2: |
| 1285 |
o> 1\n |
| 1286 |
o> readline() -> 1: |
| 1287 |
o> \n |
| 1288 |
sending listkeys command |
| 1289 |
i> write(9) -> 9: |
| 1290 |
i> listkeys\n |
| 1291 |
i> write(12) -> 12: |
| 1292 |
i> namespace 6\n |
| 1293 |
i> write(6) -> 6: phases |
| 1294 |
i> flush() -> None |
| 1295 |
o> bufferedreadline() -> 3: |
| 1296 |
o> 15\n |
| 1297 |
o> bufferedread(15) -> 15: publishing\tTrue |
| 1298 |
response: { |
| 1299 |
b'publishing': b'True' |
| 1300 |
} |
| 1301 |
|
| 1302 |
Setting public phase via pushkey |
| 1303 |
|
| 1304 |
$ hg phase --draft --force -r . |
| 1305 |
|
| 1306 |
$ debugwireproto << EOF |
| 1307 |
> command pushkey |
| 1308 |
> namespace phases |
| 1309 |
> key 7127240a084fd9dc86fe8d1f98e26229161ec82b |
| 1310 |
> old 1 |
| 1311 |
> new 0 |
| 1312 |
> EOF |
| 1313 |
testing ssh1 |
| 1314 |
creating ssh peer from handshake results |
| 1315 |
i> write(104) -> 104: |
| 1316 |
i> hello\n |
| 1317 |
i> between\n |
| 1318 |
i> pairs 81\n |
| 1319 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 1320 |
i> flush() -> None |
| 1321 |
o> readline() -> 4: |
| 1322 |
o> \d+\\n (re) |
| 1323 |
o> readline\(\) -> \d+: (re) |
| 1324 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 1325 |
o> readline() -> 2: |
| 1326 |
o> 1\n |
| 1327 |
o> readline() -> 1: |
| 1328 |
o> \n |
| 1329 |
sending pushkey command |
| 1330 |
i> write(8) -> 8: |
| 1331 |
i> pushkey\n |
| 1332 |
i> write(7) -> 7: |
| 1333 |
i> key 40\n |
| 1334 |
i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b |
| 1335 |
i> write(12) -> 12: |
| 1336 |
i> namespace 6\n |
| 1337 |
i> write(6) -> 6: phases |
| 1338 |
i> write(6) -> 6: |
| 1339 |
i> new 1\n |
| 1340 |
i> write(1) -> 1: 0 |
| 1341 |
i> write(6) -> 6: |
| 1342 |
i> old 1\n |
| 1343 |
i> write(1) -> 1: 1 |
| 1344 |
i> flush() -> None |
| 1345 |
o> bufferedreadline() -> 2: |
| 1346 |
o> 2\n |
| 1347 |
o> bufferedread(2) -> 2: |
| 1348 |
o> 1\n |
| 1349 |
response: True |
| 1350 |
|
| 1351 |
$ hg phase . |
| 1352 |
4: public |
| 1353 |
|
| 1354 |
$ cd .. |
| 1355 |
|
| 1356 |
Test batching of requests |
| 1357 |
|
| 1358 |
$ hg init batching |
| 1359 |
$ cd batching |
| 1360 |
$ echo 0 > foo |
| 1361 |
$ hg add foo |
| 1362 |
$ hg -q commit -m initial |
| 1363 |
$ hg phase --public |
| 1364 |
$ echo 1 > foo |
| 1365 |
$ hg commit -m 'commit 1' |
| 1366 |
$ hg -q up 0 |
| 1367 |
$ echo 2 > foo |
| 1368 |
$ hg commit -m 'commit 2' |
| 1369 |
created new head |
| 1370 |
$ hg book -r 1 bookA |
| 1371 |
$ hg book -r 2 bookB |
| 1372 |
|
| 1373 |
$ debugwireproto << EOF |
| 1374 |
> batchbegin |
| 1375 |
> command heads |
| 1376 |
> command listkeys |
| 1377 |
> namespace bookmarks |
| 1378 |
> command listkeys |
| 1379 |
> namespace phases |
| 1380 |
> batchsubmit |
| 1381 |
> EOF |
| 1382 |
testing ssh1 |
| 1383 |
creating ssh peer from handshake results |
| 1384 |
i> write(104) -> 104: |
| 1385 |
i> hello\n |
| 1386 |
i> between\n |
| 1387 |
i> pairs 81\n |
| 1388 |
i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
| 1389 |
i> flush() -> None |
| 1390 |
o> readline() -> 4: |
| 1391 |
o> \d+\\n (re) |
| 1392 |
o> readline\(\) -> \d+: (re) |
| 1393 |
o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) |
| 1394 |
o> readline() -> 2: |
| 1395 |
o> 1\n |
| 1396 |
o> readline() -> 1: |
| 1397 |
o> \n |
| 1398 |
sending batch with 3 sub-commands |
| 1399 |
i> write(6) -> 6: |
| 1400 |
i> batch\n |
| 1401 |
i> write(4) -> 4: |
| 1402 |
i> * 0\n |
| 1403 |
i> write(8) -> 8: |
| 1404 |
i> cmds 61\n |
| 1405 |
i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases |
| 1406 |
i> flush() -> None |
| 1407 |
o> bufferedreadline() -> 4: |
| 1408 |
o> 278\n |
| 1409 |
o> bufferedread(278) -> 278: |
| 1410 |
o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
| 1411 |
o> ;bookA\t4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
| 1412 |
o> bookB\tbfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\t1\n |
| 1413 |
o> bfebe6bd38eebc6f8202e419c1171268987ea6a6\t1\n |
| 1414 |
o> publishing\tTrue |
| 1415 |
response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
| 1416 |
response #1: bookA\t4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB\tbfebe6bd38eebc6f8202e419c1171268987ea6a6 |
| 1417 |
response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\t1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6\t1\npublishing\tTrue |