Mercurial > hg
annotate tests/wireprotohelpers.sh @ 37499:75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
This fixes min/max()/json() of map result. Before, it was taken as a lazy
byte string and stringified by evalfuncarg().
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 18 Mar 2018 23:36:52 +0900 |
parents | 61e405fb6372 |
children | 693cb3768943 |
rev | line source |
---|---|
37482
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 HTTPV2=exp-http-v2-0001 |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 MEDIATYPE=application/mercurial-exp-framing-0003 |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 sendhttpraw() { |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/ |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 } |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 |
37483
61e405fb6372
wireproto: crude support for version 2 HTTP peer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37482
diff
changeset
|
8 sendhttpv2peer() { |
61e405fb6372
wireproto: crude support for version 2 HTTP peer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37482
diff
changeset
|
9 hg --verbose debugwireproto --peer http2 http://$LOCALIP:$HGPORT/ |
61e405fb6372
wireproto: crude support for version 2 HTTP peer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37482
diff
changeset
|
10 } |
61e405fb6372
wireproto: crude support for version 2 HTTP peer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37482
diff
changeset
|
11 |
37482
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 cat > dummycommands.py << EOF |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 from mercurial import ( |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 wireprototypes, |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 wireproto, |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 ) |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 @wireproto.wireprotocommand('customreadonly', permission='pull') |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 def customreadonly(repo, proto): |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 return wireprototypes.bytesresponse(b'customreadonly bytes response') |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 @wireproto.wireprotocommand('customreadwrite', permission='push') |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 def customreadwrite(repo, proto): |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 return wireprototypes.bytesresponse(b'customreadwrite bytes response') |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 EOF |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 cat >> $HGRCPATH << EOF |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 [extensions] |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 drawdag = $TESTDIR/drawdag.py |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 EOF |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 enabledummycommands() { |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 cat >> $HGRCPATH << EOF |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 [extensions] |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 dummycommands = $TESTTMP/dummycommands.py |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 EOF |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 } |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 enablehttpv2() { |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 cat >> $1/.hg/hgrc << EOF |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 [experimental] |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 web.apiserver = true |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 web.api.http-v2 = true |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 EOF |
fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 } |