Mercurial > hg
annotate tests/test-rebase-templates.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 | f56a30b844aa |
children | 43c84b816445 |
rev | line source |
---|---|
34883
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
1 Testing templating for rebase command |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
2 |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
3 Setup |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
4 |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
5 $ cat >> $HGRCPATH <<EOF |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
6 > [extensions] |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
7 > rebase= |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
8 > [experimental] |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
9 > evolution=createmarkers |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
10 > EOF |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
11 |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
12 $ hg init repo |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
13 $ cd repo |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
14 $ for ch in a b c d; do echo foo > $ch; hg commit -Aqm "Added "$ch; done |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
15 |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
16 $ hg log -G -T "{rev}:{node|short} {desc}" |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
17 @ 3:62615734edd5 Added d |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
18 | |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
19 o 2:28ad74487de9 Added c |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
20 | |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
21 o 1:29becc82797a Added b |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
22 | |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
23 o 0:18d04c59bb5d Added a |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
24 |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
25 Getting the JSON output for nodechanges |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
26 |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
27 $ hg rebase -s 2 -d 0 -q -Tjson |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
28 [ |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
29 { |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
30 "nodechanges": {"28ad74487de9599d00d81085be739c61fc340652": ["849767420fd5519cf0026232411a943ed03cc9fb"], "62615734edd52f06b6fb9c2beb429e4fe30d57b8": ["df21b32134ba85d86bca590cbe9b8b7cbc346c53"]} |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
31 } |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
32 ] |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
33 |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
34 $ hg log -G -T "{rev}:{node|short} {desc}" |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
35 @ 5:df21b32134ba Added d |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
36 | |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
37 o 4:849767420fd5 Added c |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
38 | |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
39 | o 1:29becc82797a Added b |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
40 |/ |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
41 o 0:18d04c59bb5d Added a |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
42 |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
43 $ hg rebase -s 1 -d 5 -q -T "{nodechanges|json}" |
c858afe9c59b
rebase: add support to output nodechanges
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
44 {"29becc82797a4bc11ec8880b58eaecd2ab3e7760": ["d9d6773efc831c274eace04bc13e8e6412517139"]} (no-eol) |
35124
c157bb0120a9
tests: add test for rebase template showing wrong behavior
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34883
diff
changeset
|
45 |
c157bb0120a9
tests: add test for rebase template showing wrong behavior
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34883
diff
changeset
|
46 $ hg log -G -T "{rev}:{node|short} {desc}" |
c157bb0120a9
tests: add test for rebase template showing wrong behavior
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34883
diff
changeset
|
47 o 6:d9d6773efc83 Added b |
c157bb0120a9
tests: add test for rebase template showing wrong behavior
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34883
diff
changeset
|
48 | |
c157bb0120a9
tests: add test for rebase template showing wrong behavior
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34883
diff
changeset
|
49 @ 5:df21b32134ba Added d |
c157bb0120a9
tests: add test for rebase template showing wrong behavior
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34883
diff
changeset
|
50 | |
c157bb0120a9
tests: add test for rebase template showing wrong behavior
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34883
diff
changeset
|
51 o 4:849767420fd5 Added c |
c157bb0120a9
tests: add test for rebase template showing wrong behavior
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34883
diff
changeset
|
52 | |
c157bb0120a9
tests: add test for rebase template showing wrong behavior
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34883
diff
changeset
|
53 o 0:18d04c59bb5d Added a |
c157bb0120a9
tests: add test for rebase template showing wrong behavior
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34883
diff
changeset
|
54 |
c157bb0120a9
tests: add test for rebase template showing wrong behavior
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34883
diff
changeset
|
55 |
c157bb0120a9
tests: add test for rebase template showing wrong behavior
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34883
diff
changeset
|
56 $ hg rebase -s 6 -d 4 -q -T "{nodechanges % '{oldnode}:{newnodes % ' {node} '}'}" |
35125
f56a30b844aa
rebase: use fm.formatlist() and fm.formatdict() to support user template
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35124
diff
changeset
|
57 d9d6773efc831c274eace04bc13e8e6412517139: f48cd65c6dc3d2acb55da54402a5b029546e546f (no-eol) |