Mercurial > hg
annotate tests/test-rename-after-merge.t @ 37048:fc5e261915b9
wireproto: require POST for all HTTPv2 requests
Wire protocol version 1 transfers argument data via request
headers by default. This has historically caused problems because
servers institute limits on the length of individual HTTP headers
as well as the total size of all request headers. Mercurial servers
can advertise the maximum length of an individual header. But
there's no guarantee any intermediate HTTP agents will accept
headers up to that length.
In the existing wire protocol, server operators typically also
key off the HTTP request method to implement authentication.
For example, GET requests translate to read-only requests and
can be allowed. But read-write commands must use POST and require
authentication. This has typically worked because the only wire
protocol commands that use POST modify the repo (e.g. the
"unbundle" command).
There is an experimental feature to enable clients to transmit
argument data via POST request bodies. This is technically a
better and more robust solution. But we can't enable it by default
because of servers assuming POST means write access.
In version 2 of the wire protocol, the permissions of a request
are encoded in the URL. And with it being a new protocol in a new
URL space, we're not constrained by backwards compatibility
requirements.
This commit adopts the technically superior mechanism of using
HTTP request bodies to send argument data by requiring POST for
all commands. Strictly speaking, it may be possible to send
request bodies on GET requests. But my experience is that not all
HTTP stacks support this. POST pretty much always works. Using POST
for read-only operations does sacrifice some RESTful design
purity. But this API cares about practicality, not about being
in Roy T. Fielding's REST ivory tower.
There's a chance we may relax this restriction in the future. But
for now, I want to see how far we can get with a POST only API.
Differential Revision: https://phab.mercurial-scm.org/D2837
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 13 Mar 2018 11:57:43 -0700 |
parents | eb586ed5d8ce |
children | eb9835014d20 |
rev | line source |
---|---|
12399
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12328
diff
changeset
|
1 Issue746: renaming files brought by the second parent of a merge was |
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12328
diff
changeset
|
2 broken. |
5318
c6682cdada2f
Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 |
12279 | 4 Create source repository: |
5 | |
6 $ hg init t | |
7 $ cd t | |
8 $ echo a > a | |
9 $ hg ci -Am a | |
10 adding a | |
11 $ cd .. | |
12 | |
13 Fork source repository: | |
5318
c6682cdada2f
Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 |
12279 | 15 $ hg clone t t2 |
16 updating to branch default | |
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
18 $ cd t2 | |
19 $ echo b > b | |
20 $ hg ci -Am b | |
21 adding b | |
22 | |
23 Update source repository: | |
24 | |
25 $ cd ../t | |
26 $ echo a >> a | |
27 $ hg ci -m a2 | |
28 | |
29 Merge repositories: | |
5318
c6682cdada2f
Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
30 |
12279 | 31 $ hg pull ../t2 |
32 pulling from ../t2 | |
33 searching for changes | |
34 adding changesets | |
35 adding manifests | |
36 adding file changes | |
37 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:
16913
diff
changeset
|
38 new changesets d2ae7f538514 |
12279 | 39 (run 'hg heads' to see heads, 'hg merge' to merge) |
40 | |
41 $ hg merge | |
42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
43 (branch merge, don't forget to commit) | |
5318
c6682cdada2f
Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
44 |
12279 | 45 $ hg st |
46 M b | |
47 | |
48 Rename b as c: | |
5318
c6682cdada2f
Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 |
12279 | 50 $ hg mv b c |
51 $ hg st | |
52 A c | |
53 R b | |
54 | |
55 Rename back c as b: | |
56 | |
57 $ hg mv c b | |
58 $ hg st | |
59 M b | |
60 | |
61 $ cd .. | |
7689
d821ea464465
Fix a corner case when committing a rename after a merge (issue1476)
Patrick Mezard <pmezard@gmail.com>
parents:
5608
diff
changeset
|
62 |
12399
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12328
diff
changeset
|
63 Issue 1476: renaming a first parent file into another first parent |
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12328
diff
changeset
|
64 file while none of them belong to the second parent was broken |
12279 | 65 |
66 $ hg init repo1476 | |
67 $ cd repo1476 | |
68 $ echo a > a | |
69 $ hg ci -Am adda | |
70 adding a | |
71 $ echo b1 > b1 | |
72 $ echo b2 > b2 | |
73 $ hg ci -Am changea | |
74 adding b1 | |
75 adding b2 | |
76 $ hg up -C 0 | |
77 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
78 $ echo c1 > c1 | |
79 $ echo c2 > c2 | |
80 $ hg ci -Am addcandd | |
81 adding c1 | |
82 adding c2 | |
83 created new head | |
84 | |
85 Merge heads: | |
86 | |
87 $ hg merge | |
88 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
89 (branch merge, don't forget to commit) | |
90 | |
91 $ hg mv -Af c1 c2 | |
7689
d821ea464465
Fix a corner case when committing a rename after a merge (issue1476)
Patrick Mezard <pmezard@gmail.com>
parents:
5608
diff
changeset
|
92 |
12279 | 93 Commit issue 1476: |
7689
d821ea464465
Fix a corner case when committing a rename after a merge (issue1476)
Patrick Mezard <pmezard@gmail.com>
parents:
5608
diff
changeset
|
94 |
12279 | 95 $ hg ci -m merge |
7689
d821ea464465
Fix a corner case when committing a rename after a merge (issue1476)
Patrick Mezard <pmezard@gmail.com>
parents:
5608
diff
changeset
|
96 |
12279 | 97 $ hg log -r tip -C -v | grep copies |
98 copies: c2 (c1) | |
99 | |
100 $ hg rollback | |
13446
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
12399
diff
changeset
|
101 repository tip rolled back to revision 2 (undo commit) |
13455
053c042118bc
rollback, i18n: avoid parameterized message
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
13446
diff
changeset
|
102 working directory now based on revisions 2 and 1 |
12279 | 103 |
104 $ hg up -C . | |
105 2 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
106 | |
107 Merge heads again: | |
108 | |
109 $ hg merge | |
110 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
111 (branch merge, don't forget to commit) | |
112 | |
113 $ hg mv -Af b1 b2 | |
114 | |
115 Commit issue 1476 with a rename on the other side: | |
116 | |
117 $ hg ci -m merge | |
118 | |
119 $ hg log -r tip -C -v | grep copies | |
120 copies: b2 (b1) | |
121 | |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
13455
diff
changeset
|
122 $ cd .. |