annotate tests/test-wireproto-command-lookup.t @ 39859:32d3ed3023bb

upgrade: use rawsize() instead of revlog index The revlog index is a very low-level data structure and it shouldn't be exposed to the storage interface - at least not in its current form. upgrade.py is the only consumer of the index attribute on file storage in the repository. This commit rewrites that final consumer to use rawsize() instead of going through the index. This is actually the more proper API to use, as rawsize() will accurately report the size of revisions which have a negative size in the index. Differential Revision: https://phab.mercurial-scm.org/D4719
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 24 Sep 2018 09:38:27 -0700
parents 07b58266bce3
children 393e44324037
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37538
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1 $ . $TESTDIR/wireprotohelpers.sh
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
2
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
3 $ hg init server
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
4 $ enablehttpv2 server
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
5 $ cd server
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
6 $ cat >> .hg/hgrc << EOF
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
7 > [web]
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
8 > push_ssl = false
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
9 > allow-push = *
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
10 > EOF
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
11 $ hg debugdrawdag << EOF
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
12 > C D
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
13 > |/
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
14 > B
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
15 > |
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
16 > A
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
17 > EOF
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
18
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
19 $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
20 $ cat hg.pid > $DAEMON_PIDS
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
21
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
22 lookup for known node works
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
23
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
24 $ sendhttpv2peer << EOF
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
25 > command lookup
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
26 > key 426bada5c67598ca65036d57d9e4b64b0c1ce7a0
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
27 > EOF
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
28 creating http peer for wire protocol version 2
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
29 sending lookup command
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
30 s> *\r\n (glob)
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
31 s> Accept-Encoding: identity\r\n
37725
3ea8323d6f95 wireprotov2: change command response protocol to include a leading map
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37724
diff changeset
32 s> accept: application/mercurial-exp-framing-0005\r\n
3ea8323d6f95 wireprotov2: change command response protocol to include a leading map
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37724
diff changeset
33 s> content-type: application/mercurial-exp-framing-0005\r\n
37538
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
34 s> content-length: 73\r\n
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
35 s> host: $LOCALIP:$HGPORT\r\n (glob)
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
36 s> user-agent: Mercurial debugwireproto\r\n
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
37 s> \r\n
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
38 s> A\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa1CkeyX(426bada5c67598ca65036d57d9e4b64b0c1ce7a0DnameFlookup
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
39 s> makefile('rb', None)
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
40 s> HTTP/1.1 200 OK\r\n
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
41 s> Server: testing stub value\r\n
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
42 s> Date: $HTTP_DATE$\r\n
37725
3ea8323d6f95 wireprotov2: change command response protocol to include a leading map
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37724
diff changeset
43 s> Content-Type: application/mercurial-exp-framing-0005\r\n
37538
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
44 s> Transfer-Encoding: chunked\r\n
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
45 s> \r\n
39559
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
46 s> 13\r\n
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
47 s> \x0b\x00\x00\x01\x00\x02\x011
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
48 s> \xa1FstatusBok
37538
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
49 s> \r\n
39559
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
50 received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation)
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
51 s> 1d\r\n
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
52 s> \x15\x00\x00\x01\x00\x02\x001
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
53 s> TBk\xad\xa5\xc6u\x98\xcae\x03mW\xd9\xe4\xb6K\x0c\x1c\xe7\xa0
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
54 s> \r\n
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
55 received frame(size=21; request=1; stream=2; streamflags=; type=command-response; flags=continuation)
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
56 s> 8\r\n
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
57 s> \x00\x00\x00\x01\x00\x02\x002
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
58 s> \r\n
37538
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
59 s> 0\r\n
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
60 s> \r\n
39559
07b58266bce3 wireprotov2: implement commands as a generator of objects
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
61 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos)
37721
f7673845b167 wireprotov2: decode responses to their expected types
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37718
diff changeset
62 response: b'Bk\xad\xa5\xc6u\x98\xcae\x03mW\xd9\xe4\xb6K\x0c\x1c\xe7\xa0'
37538
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
63
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
64 $ cat error.log