Mercurial > hg
comparison tests/wireprotohelpers.sh @ 37482:fa9faf58959d
tests: extract wire protocol shell helpers to standalone file
This will make it easier for other tests to get up and running without
the boilerplate.
Differential Revision: https://phab.mercurial-scm.org/D3176
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 26 Mar 2018 15:34:52 -0700 |
parents | |
children | 61e405fb6372 |
comparison
equal
deleted
inserted
replaced
37481:7c848ab13eff | 37482:fa9faf58959d |
---|---|
1 HTTPV2=exp-http-v2-0001 | |
2 MEDIATYPE=application/mercurial-exp-framing-0003 | |
3 | |
4 sendhttpraw() { | |
5 hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/ | |
6 } | |
7 | |
8 cat > dummycommands.py << EOF | |
9 from mercurial import ( | |
10 wireprototypes, | |
11 wireproto, | |
12 ) | |
13 | |
14 @wireproto.wireprotocommand('customreadonly', permission='pull') | |
15 def customreadonly(repo, proto): | |
16 return wireprototypes.bytesresponse(b'customreadonly bytes response') | |
17 | |
18 @wireproto.wireprotocommand('customreadwrite', permission='push') | |
19 def customreadwrite(repo, proto): | |
20 return wireprototypes.bytesresponse(b'customreadwrite bytes response') | |
21 EOF | |
22 | |
23 cat >> $HGRCPATH << EOF | |
24 [extensions] | |
25 drawdag = $TESTDIR/drawdag.py | |
26 EOF | |
27 | |
28 enabledummycommands() { | |
29 cat >> $HGRCPATH << EOF | |
30 [extensions] | |
31 dummycommands = $TESTTMP/dummycommands.py | |
32 EOF | |
33 } | |
34 | |
35 enablehttpv2() { | |
36 cat >> $1/.hg/hgrc << EOF | |
37 [experimental] | |
38 web.apiserver = true | |
39 web.api.http-v2 = true | |
40 EOF | |
41 } |