Mercurial > hg
annotate tests/test-sparse-requirement.t @ 37483:61e405fb6372
wireproto: crude support for version 2 HTTP peer
As part of implementing the server-side bits of the wire protocol
command handlers for version 2, we want a way to easily test those
commands. Currently, we use the "httprequest" action of `hg
debugwireproto`. But this requires explicitly specifying the HTTP
request headers, low-level frame details, and the data structure
to encode with CBOR. That's a lot of boilerplate and a lot of it can
change as the wire protocol evolves.
`hg debugwireproto` has a mechanism to issue commands via the peer
interface. That is *much* easier to use and we prefer to test with
that going forward.
This commit implements enough parts of the peer API to send basic
requests via the HTTP version 2 transport.
The peer code is super hacky. Again, the goal is to facilitate
server testing, not robustly implement a client. The client code
will receive love at a later time.
Differential Revision: https://phab.mercurial-scm.org/D3177
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 28 Mar 2018 15:09:34 -0700 |
parents | c2c8962a9465 |
children | 74a519c86625 |
rev | line source |
---|---|
33556
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 $ hg init repo |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 $ cd repo |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 $ touch a.html b.html c.py d.py |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 $ cat > frontend.sparse << EOF |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 > [include] |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 > *.html |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 > EOF |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 $ hg -q commit -A -m initial |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 $ echo 1 > a.html |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 $ echo 1 > c.py |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 $ hg commit -m 'commit 1' |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 Enable sparse profile |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 $ cat .hg/requires |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 dotencode |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 fncache |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 generaldelta |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 revlogv1 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 store |
37415
c2c8962a9465
simplestore: use a custom store for the simple store repo
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33556
diff
changeset
|
25 testonly-simplestore (reposimplestore !) |
33556
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 $ hg debugsparse --config extensions.sparse= --enable-profile frontend.sparse |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 $ ls |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 a.html |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 b.html |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 Requirement for sparse added when sparse is enabled |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 $ cat .hg/requires |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 dotencode |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 exp-sparse |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 fncache |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 generaldelta |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 revlogv1 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 store |
37415
c2c8962a9465
simplestore: use a custom store for the simple store repo
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33556
diff
changeset
|
41 testonly-simplestore (reposimplestore !) |
33556
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 Client without sparse enabled reacts properly |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 $ hg files |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
46 abort: repository is using sparse feature but sparse is not enabled; enable the "sparse" extensions to access! |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
47 [255] |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
48 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 Requirement for sparse is removed when sparse is disabled |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
50 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 $ hg debugsparse --reset --config extensions.sparse= |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
52 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
53 $ cat .hg/requires |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
54 dotencode |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
55 fncache |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
56 generaldelta |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
57 revlogv1 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 store |
37415
c2c8962a9465
simplestore: use a custom store for the simple store repo
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33556
diff
changeset
|
59 testonly-simplestore (reposimplestore !) |
33556
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 And client without sparse can access |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
62 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 $ hg files |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 a.html |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 b.html |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
66 c.py |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
67 d.py |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
68 frontend.sparse |