annotate tests/test-simple-update.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13956
ffb5c09ba822 tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents: 12365
diff changeset
1 $ hg init test
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
2 $ cd test
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
3 $ echo foo>foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
4 $ hg addremove
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
5 adding foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
6 $ hg commit -m "1"
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
7
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
8 $ hg verify
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
9 checking changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
10 checking manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
11 crosschecking files in changesets and manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
12 checking files
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
13 1 files, 1 changesets, 1 total revisions
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
14
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
15 $ hg clone . ../branch
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
16 updating to branch default
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
18 $ cd ../branch
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
19 $ hg co
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
20 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
21 $ echo bar>>foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
22 $ hg commit -m "2"
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
23
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
24 $ cd ../test
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
25
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
26 $ hg pull ../branch
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
27 pulling from ../branch
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
28 searching for changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
29 adding changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
30 adding manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
31 adding file changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
32 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: 32940
diff changeset
33 new changesets 30aff43faee1
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
34 (run 'hg update' to get a working copy)
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
35
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
36 $ hg verify
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
37 checking changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
38 checking manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
39 crosschecking files in changesets and manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
40 checking files
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
41 1 files, 2 changesets, 2 total revisions
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
42
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
43 $ hg co
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
44 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
45
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
46 $ cat foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
47 foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
48 bar
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
49
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
50 $ hg manifest --debug
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
51 6f4310b00b9a147241b071a60c28a650827fb03d 644 foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 3736
diff changeset
52
13960
190e5f2043d9 update: fix check for no rev when a date is given
Idan Kamara <idankk86@gmail.com>
parents: 13956
diff changeset
53 update to rev 0 with a date
190e5f2043d9 update: fix check for no rev when a date is given
Idan Kamara <idankk86@gmail.com>
parents: 13956
diff changeset
54
190e5f2043d9 update: fix check for no rev when a date is given
Idan Kamara <idankk86@gmail.com>
parents: 13956
diff changeset
55 $ hg upd -d foo 0
190e5f2043d9 update: fix check for no rev when a date is given
Idan Kamara <idankk86@gmail.com>
parents: 13956
diff changeset
56 abort: you can't specify a revision and a date
190e5f2043d9 update: fix check for no rev when a date is given
Idan Kamara <idankk86@gmail.com>
parents: 13956
diff changeset
57 [255]
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 13960
diff changeset
58
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 13960
diff changeset
59 $ cd ..
31117
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
60
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
61 update with worker processes
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
62
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
63 #if no-windows
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
64
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
65 $ cat <<EOF > forceworker.py
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
66 > from mercurial import extensions, worker
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
67 > def nocost(orig, ui, costperop, nops):
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
68 > return worker._numworkers(ui) > 1
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
69 > def uisetup(ui):
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
70 > extensions.wrapfunction(worker, 'worthwhile', nocost)
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
71 > EOF
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
72
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
73 $ hg init worker
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
74 $ cd worker
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
75 $ cat <<EOF >> .hg/hgrc
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
76 > [extensions]
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
77 > forceworker = $TESTTMP/forceworker.py
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
78 > [worker]
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
79 > numcpus = 4
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
80 > EOF
32940
75be14993fda cleanup: use $PYTHON to run python in many more tests
Augie Fackler <augie@google.com>
parents: 31118
diff changeset
81 $ for i in `$PYTHON $TESTDIR/seq.py 1 100`; do
31117
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
82 > echo $i > $i
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
83 > done
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
84 $ hg ci -qAm 'add 100 files'
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
85
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
86 $ hg update null
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
87 0 files updated, 0 files merged, 100 files removed, 0 files unresolved
31118
a91c62752d08 worker: flush messages written by child processes before exit
Yuya Nishihara <yuya@tcha.org>
parents: 31117
diff changeset
88 $ hg update -v | grep 100
a91c62752d08 worker: flush messages written by child processes before exit
Yuya Nishihara <yuya@tcha.org>
parents: 31117
diff changeset
89 getting 100
31117
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
90 100 files updated, 0 files merged, 0 files removed, 0 files unresolved
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
91
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
92 $ cd ..
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
93
92bca12328d1 worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
94 #endif