annotate tests/test-issue586.t @ 37054:40206e227412

wireproto: define and implement protocol for issuing requests The existing HTTP and SSH wire protocols suffer from a host of flaws and shortcomings. I've been wanting to rewrite the protocol for a while now. Supporting partial clone - which will require new wire protocol commands and capabilities - and other advanced server functionality will be much easier if we start from a clean slate and don't have to be constrained by limitations of the existing wire protocol. This commit starts to introduce a new data exchange format for use over the wire protocol. The new protocol is built on top of "frames," which are atomic units of metadata + data. Frames will make it easier to implement proxies and other mechanisms that want to inspect data without having to maintain state. The existing frame metadata is very minimal and it will evolve heavily. (We will eventually support things like concurrent requests, out-of-order responses, compression, side-channels for status updates, etc. Some of these will require additions to the frame header.) Another benefit of frames is that all reads are of a fixed size. A reader works by consuming a frame header, extracting the payload length, then reading that many bytes. No lookahead, buffering, or memory reallocations are needed. The new protocol attempts to be transport agnostic. I want all that's required to use the new protocol to be a pair of unidirectional, half-duplex pipes. (Yes, we will eventually make use of full-duplex pipes, but that's for another commit.) Notably, when the SSH transport switches to this new protocol, stderr will be unused. This is by design: the lack of stderr on HTTP harms protocol behavior there. By shoehorning everything into a pair of pipes, we can have more consistent behavior across transports. We currently only define the client side parts of the new protocol, specifically the bits for requesting that a command run. This keeps the new code and feature small and somewhat easy to review. We add support to `hg debugwireproto` for writing frames into HTTP request bodies. Our tests that issue commands to the new HTTP endpoint have been updated to transmit frames. The server bits haven't been touched to consume the frames yet. This will occur in the next commit... Astute readers may notice that the command name is transmitted in both the HTTP request URL and the command request frame. This is partially a kludge from me initially implementing the frame-based protocol for SSH first. But it is also a feature: I intend to eventually support issuing multiple commands per HTTP request. This will allow us to replace the abomination that is the "batch" wire protocol command with a protocol-level mechanism for performing multi-dispatch. Because I want the frame-based protocol to be as similar as possible across transports, I'd rather we (redundantly) include the command name in the frame than differ behavior between transports that have out-of-band routing information (like HTTP) readily available. Differential Revision: https://phab.mercurial-scm.org/D2851
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 19 Mar 2018 16:49:53 -0700
parents eb586ed5d8ce
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 11846
diff changeset
1 Issue586: removing remote files after merge appears to corrupt the
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 11846
diff changeset
2 dirstate
4535
720ae5085ee3 commit: fix bug where dirstate for removed file is confused
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
3
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
4 $ hg init a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
5 $ cd a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
6 $ echo a > a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
7 $ hg ci -Ama
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
8 adding a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
9
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
10 $ hg init ../b
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
11 $ cd ../b
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
12 $ echo b > b
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
13 $ hg ci -Amb
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
14 adding b
4535
720ae5085ee3 commit: fix bug where dirstate for removed file is confused
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
15
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
16 $ hg pull -f ../a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
17 pulling from ../a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
18 searching for changes
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
19 warning: repository is unrelated
13742
7abab875e647 discovery: avoid discovery when local graph is a subset of remote
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 12399
diff changeset
20 requesting all changes
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
21 adding changesets
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
22 adding manifests
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
23 adding file changes
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
24 added 1 changesets with 1 changes to 1 files (+1 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 28251
diff changeset
25 new changesets cb9a9f314b8b
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
26 (run 'hg heads' to see heads, 'hg merge' to merge)
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
27 $ hg merge
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
28 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
29 (branch merge, don't forget to commit)
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
30 $ hg rm -f a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
31 $ hg ci -Amc
4535
720ae5085ee3 commit: fix bug where dirstate for removed file is confused
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
32
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
33 $ hg st -A
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
34 C b
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
35 $ cd ..
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
36
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 11846
diff changeset
37 Issue1433: Traceback after two unrelated pull, two move, a merge and
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 11846
diff changeset
38 a commit (related to issue586)
4535
720ae5085ee3 commit: fix bug where dirstate for removed file is confused
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
39
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
40 create test repos
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
41
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
42 $ hg init repoa
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
43 $ touch repoa/a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
44 $ hg -R repoa ci -Am adda
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
45 adding a
7564
f1af59451c0c localrepo: fix bad manifest delta generation (issue1433)
Patrick Mezard <pmezard@gmail.com>
parents: 4535
diff changeset
46
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
47 $ hg init repob
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
48 $ touch repob/b
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
49 $ hg -R repob ci -Am addb
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
50 adding b
7564
f1af59451c0c localrepo: fix bad manifest delta generation (issue1433)
Patrick Mezard <pmezard@gmail.com>
parents: 4535
diff changeset
51
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
52 $ hg init repoc
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
53 $ cd repoc
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
54 $ hg pull ../repoa
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
55 pulling from ../repoa
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
56 requesting all changes
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
57 adding changesets
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
58 adding manifests
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
59 adding file changes
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
60 added 1 changesets with 1 changes to 1 files
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 28251
diff changeset
61 new changesets 7132ab4568ac
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
62 (run 'hg update' to get a working copy)
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
63 $ hg update
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
64 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
65 $ mkdir tst
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
66 $ hg mv * tst
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
67 $ hg ci -m "import a in tst"
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
68 $ hg pull -f ../repob
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
69 pulling from ../repob
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
70 searching for changes
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
71 warning: repository is unrelated
13742
7abab875e647 discovery: avoid discovery when local graph is a subset of remote
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 12399
diff changeset
72 requesting all changes
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
73 adding changesets
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
74 adding manifests
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
75 adding file changes
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
76 added 1 changesets with 1 changes to 1 files (+1 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 28251
diff changeset
77 new changesets 5ddceb349652
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
78 (run 'hg heads' to see heads, 'hg merge' to merge)
7564
f1af59451c0c localrepo: fix bad manifest delta generation (issue1433)
Patrick Mezard <pmezard@gmail.com>
parents: 4535
diff changeset
79
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
80 merge both repos
7564
f1af59451c0c localrepo: fix bad manifest delta generation (issue1433)
Patrick Mezard <pmezard@gmail.com>
parents: 4535
diff changeset
81
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
82 $ hg merge
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
84 (branch merge, don't forget to commit)
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
85 $ mkdir src
7564
f1af59451c0c localrepo: fix bad manifest delta generation (issue1433)
Patrick Mezard <pmezard@gmail.com>
parents: 4535
diff changeset
86
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
87 move b content
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
88
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
89 $ hg mv b src
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
90 $ hg ci -m "import b in src"
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
91 $ hg manifest
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
92 src/b
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
93 tst/a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
94
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 13742
diff changeset
95 $ cd ..