Mercurial > hg
annotate tests/test-merge-remove.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 | 41ef02ba329b |
children | f785073f792c |
rev | line source |
---|---|
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
1 $ hg init |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
2 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
3 $ echo foo > foo |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
4 $ echo bar > bar |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
5 $ hg ci -qAm 'add foo bar' |
6297
fed1a9c22076
dirstate.remove: during merges, remember the previous file state
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
6 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
7 $ echo foo2 >> foo |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
8 $ echo bleh > bar |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
9 $ hg ci -m 'change foo bar' |
6297
fed1a9c22076
dirstate.remove: during merges, remember the previous file state
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
10 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
11 $ hg up -qC 0 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
12 $ hg mv foo foo1 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
13 $ echo foo1 > foo1 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
14 $ hg cat foo >> foo1 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
15 $ hg ci -m 'mv foo foo1' |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
16 created new head |
6297
fed1a9c22076
dirstate.remove: during merges, remember the previous file state
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
17 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
18 $ hg merge |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
19 merging foo1 and foo to foo1 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
20 1 files updated, 1 files merged, 0 files removed, 0 files unresolved |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
21 (branch merge, don't forget to commit) |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
22 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
23 $ hg debugstate --nodates |
23840
ddc17eaf0f1b
debugdirstate: don't hide date field with --nodate, just show 'set'/'unset'
Mads Kiilerich <madski@unity3d.com>
parents:
22897
diff
changeset
|
24 m 0 -2 unset bar |
ddc17eaf0f1b
debugdirstate: don't hide date field with --nodate, just show 'set'/'unset'
Mads Kiilerich <madski@unity3d.com>
parents:
22897
diff
changeset
|
25 m 0 -2 unset foo1 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
26 copy: foo -> foo1 |
6297
fed1a9c22076
dirstate.remove: during merges, remember the previous file state
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
27 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
28 $ hg st -q |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
29 M bar |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
30 M foo1 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
31 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
32 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
33 Removing foo1 and bar: |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
34 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
35 $ cp foo1 F |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
36 $ cp bar B |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
37 $ hg rm -f foo1 bar |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
38 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
39 $ hg debugstate --nodates |
23840
ddc17eaf0f1b
debugdirstate: don't hide date field with --nodate, just show 'set'/'unset'
Mads Kiilerich <madski@unity3d.com>
parents:
22897
diff
changeset
|
40 r 0 -1 set bar |
ddc17eaf0f1b
debugdirstate: don't hide date field with --nodate, just show 'set'/'unset'
Mads Kiilerich <madski@unity3d.com>
parents:
22897
diff
changeset
|
41 r 0 -1 set foo1 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
42 copy: foo -> foo1 |
6297
fed1a9c22076
dirstate.remove: during merges, remember the previous file state
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
43 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
44 $ hg st -qC |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
45 R bar |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
46 R foo1 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
47 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
48 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
49 Re-adding foo1 and bar: |
6297
fed1a9c22076
dirstate.remove: during merges, remember the previous file state
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
50 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
51 $ cp F foo1 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
52 $ cp B bar |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
53 $ hg add -v foo1 bar |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
54 adding bar |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
55 adding foo1 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
56 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
57 $ hg debugstate --nodates |
23840
ddc17eaf0f1b
debugdirstate: don't hide date field with --nodate, just show 'set'/'unset'
Mads Kiilerich <madski@unity3d.com>
parents:
22897
diff
changeset
|
58 n 0 -2 unset bar |
ddc17eaf0f1b
debugdirstate: don't hide date field with --nodate, just show 'set'/'unset'
Mads Kiilerich <madski@unity3d.com>
parents:
22897
diff
changeset
|
59 n 0 -2 unset foo1 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
60 copy: foo -> foo1 |
6298
53cbb33e1269
normallookup: during merges, restore the state saved by remove
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6297
diff
changeset
|
61 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
62 $ hg st -qC |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
63 M bar |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
64 M foo1 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
65 foo |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
66 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
67 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
68 Reverting foo1 and bar: |
6299
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6298
diff
changeset
|
69 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
70 $ hg revert -vr . foo1 bar |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
71 saving current version of bar as bar.orig |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
72 reverting bar |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
73 saving current version of foo1 as foo1.orig |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
74 reverting foo1 |
6299
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6298
diff
changeset
|
75 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
76 $ hg debugstate --nodates |
23840
ddc17eaf0f1b
debugdirstate: don't hide date field with --nodate, just show 'set'/'unset'
Mads Kiilerich <madski@unity3d.com>
parents:
22897
diff
changeset
|
77 n 0 -2 unset bar |
ddc17eaf0f1b
debugdirstate: don't hide date field with --nodate, just show 'set'/'unset'
Mads Kiilerich <madski@unity3d.com>
parents:
22897
diff
changeset
|
78 n 0 -2 unset foo1 |
12260
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
79 copy: foo -> foo1 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
80 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
81 $ hg st -qC |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
82 M bar |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
83 M foo1 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
84 foo |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
85 |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
86 $ hg diff |
0a63e91c519d
tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents:
6299
diff
changeset
|
87 |
20415
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
88 Merge should not overwrite local file that is untracked after remove |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
89 |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
90 $ rm * |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
91 $ hg up -qC |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
92 $ hg rm bar |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
93 $ hg ci -m 'remove bar' |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
94 $ echo 'memories of buried pirate treasure' > bar |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
95 $ hg merge |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
96 bar: untracked file differs |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
97 abort: untracked files in working directory differ from files in requested revision |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
98 [255] |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
99 $ cat bar |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
100 memories of buried pirate treasure |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
101 |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
102 Those who use force will lose |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
103 |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
104 $ hg merge -f |
30062
940c05b25b07
merge: add conflict labels to merge command
Simon Farnsworth <simonfar@fb.com>
parents:
29775
diff
changeset
|
105 other [merge rev] changed bar which local [working copy] deleted |
27599
ad5966de3c9a
filemerge: default change/delete conflicts to 'leave unresolved' (BC)
Siddharth Agarwal <sid0@fb.com>
parents:
27163
diff
changeset
|
106 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u |
20415
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
107 merging foo1 and foo to foo1 |
27599
ad5966de3c9a
filemerge: default change/delete conflicts to 'leave unresolved' (BC)
Siddharth Agarwal <sid0@fb.com>
parents:
27163
diff
changeset
|
108 0 files updated, 1 files merged, 0 files removed, 1 files unresolved |
35704
41ef02ba329b
merge: add `--abort` flag which can abort the merge
Pulkit Goyal <7895pulkit@gmail.com>
parents:
30062
diff
changeset
|
109 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
27599
ad5966de3c9a
filemerge: default change/delete conflicts to 'leave unresolved' (BC)
Siddharth Agarwal <sid0@fb.com>
parents:
27163
diff
changeset
|
110 [1] |
20415
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
111 $ cat bar |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
112 bleh |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
113 $ hg st |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
114 M bar |
e4d7cbc94219
merge: don't overwrite file untracked after remove, abort with 'untracked files'
Mads Kiilerich <madski@unity3d.com>
parents:
12260
diff
changeset
|
115 M foo1 |