annotate tests/test-push-checkheads-superceed-A7.t @ 37047:fddcb51b5084

wireproto: define permissions-based routing of HTTPv2 wire protocol Now that we have a scaffolding for serving version 2 of the HTTP protocol, let's start implementing it. A good place to start is URL routing and basic request processing semantics. We can focus on content types, capabilities detect, etc later. Version 2 of the HTTP wire protocol encodes the needed permissions of the request in the URL path. The reasons for this are documented in the added documentation. In short, a) it makes it really easy and fail proof for server administrators to implement path-based authentication and b) it will enable clients to realize very early in a server exchange that authentication will be required to complete the operation. This latter point avoids all kinds of complexity and problems, like dealing with Expect: 100-continue and clients finding out later during `hg push` that they need to provide authentication. This will avoid the current badness where clients send a full bundle, get an HTTP 403, provide authentication, then retransmit the bundle. In order to implement command checking, we needed to implement a protocol handler for the new wire protocol. Our handler is just small enough to run the code we've implemented. Tests for the defined functionality have been added. I very much want to refactor the permissions checking code and define a better response format. But this can be done later. Nothing is covered by backwards compatibility at this point. Differential Revision: https://phab.mercurial-scm.org/D2836
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 19 Mar 2018 16:43:47 -0700
parents 1a09dad8b85a
children 89630d0b3e23
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31980
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
1 ====================================
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
2 Testing head checking code: Case A-7
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
3 ====================================
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
4
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
5 Mercurial checks for the introduction of new heads on push. Evolution comes
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
6 into play to detect if existing branches on the server are being replaced by
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
7 some of the new one we push.
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
8
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
9 This case is part of a series of tests checking this behavior.
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
10
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
11 Category A: simple case involving a branch being superceeded by another.
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
12 TestCase 7: multi-changeset branch, split on multiple other, (head on its own branch), same number of head
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
13
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
14 .. old-state:
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
15 ..
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
16 .. * 2 branch (1-changeset, and 2-changesets)
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
17 ..
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
18 .. new-state:
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
19 ..
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
20 .. * 1 new branch superceeding the head of the old-2-changesets-branch,
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
21 .. * 1 new changesets on the old-1-changeset-branch superceeding the base of the other
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
22 ..
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
23 .. expected-result:
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
24 ..
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
25 .. * push allowed
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
26 ..
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
27 .. graph-summary:
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
28 ..
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
29 .. B ø⇠◔ B'
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
30 .. | |
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
31 .. A'◔⇢ø |
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
32 .. | |/
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
33 .. C ● |
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
34 .. \|
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
35 .. ●
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
36
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
37 $ . $TESTDIR/testlib/push-checkheads-util.sh
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
38
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
39 Test setup
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
40 ----------
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
41
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
42 $ mkdir A7
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
43 $ cd A7
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
44 $ setuprepos
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
45 creating basic server and client repo
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
46 updating to branch default
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
47 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
48 $ cd server
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
49 $ mkcommit B0
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
50 $ hg up 0
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
51 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
52 $ mkcommit C0
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
53 created new head
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
54 $ cd ../client
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
55 $ hg pull
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34661
diff changeset
56 pulling from $TESTTMP/A7/server
31980
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
57 searching for changes
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
58 adding changesets
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
59 adding manifests
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
60 adding file changes
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
61 added 2 changesets with 2 changes to 2 files (+1 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33542
diff changeset
62 new changesets d73caddc5533:0f88766e02d6
31980
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
63 (run 'hg heads' to see heads, 'hg merge' to merge)
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
64 $ hg up 'desc(C0)'
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
65 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
66 $ mkcommit A1
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
67 $ hg up 0
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
68 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
69 $ mkcommit B1
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
70 created new head
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
71 $ hg debugobsolete `getid "desc(A0)" ` `getid "desc(A1)"`
33542
b11e8c67fb0f debugobsolete: also report the number of obsoleted changesets
Boris Feld <boris.feld@octobus.net>
parents: 33252
diff changeset
72 obsoleted 1 changesets
35709
1a09dad8b85a evolution: report new unstable changesets
Martin von Zweigbergk <martinvonz@google.com>
parents: 35393
diff changeset
73 1 new orphan changesets
31980
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
74 $ hg debugobsolete `getid "desc(B0)" ` `getid "desc(B1)"`
33542
b11e8c67fb0f debugobsolete: also report the number of obsoleted changesets
Boris Feld <boris.feld@octobus.net>
parents: 33252
diff changeset
75 obsoleted 1 changesets
31980
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
76 $ hg log -G --hidden
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
77 @ 25c56d33e4c4 (draft): B1
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
78 |
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
79 | o a0802eb7fc1b (draft): A1
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
80 | |
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
81 | o 0f88766e02d6 (draft): C0
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
82 |/
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
83 | x d73caddc5533 (draft): B0
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
84 | |
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
85 | x 8aaa48160adc (draft): A0
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
86 |/
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
87 o 1e4be0697311 (public): root
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
88
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
89
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
90 Actual testing
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
91 --------------
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
92
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
93 $ hg push
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34661
diff changeset
94 pushing to $TESTTMP/A7/server
31980
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
95 searching for changes
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
96 adding changesets
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
97 adding manifests
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
98 adding file changes
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
99 added 2 changesets with 2 changes to 2 files (+1 heads)
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
100 2 new obsolescence markers
33252
53b3a1968aa6 obsolete: reports the number of local changeset obsoleted when unbundling
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 31980
diff changeset
101 obsoleted 2 changesets
31980
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
102
276390e0ccfc obsolescence: add test for the "branch replacement" logic during push, case A7
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
103 $ cd ../..