Show More
@@ -0,0 +1,74 | |||||
|
1 | This is a test of the push wire protocol over CGI-based hgweb. | |||
|
2 | ||||
|
3 | initialize repository | |||
|
4 | ||||
|
5 | $ hg init r | |||
|
6 | $ cd r | |||
|
7 | $ echo a > a | |||
|
8 | $ hg ci -A -m "0" | |||
|
9 | adding a | |||
|
10 | $ echo '[web]' > .hg/hgrc | |||
|
11 | $ echo 'allow_push = *' >> .hg/hgrc | |||
|
12 | $ echo 'push_ssl = false' >> .hg/hgrc | |||
|
13 | ||||
|
14 | create hgweb invocation script | |||
|
15 | ||||
|
16 | $ cat >hgweb.cgi <<HGWEB | |||
|
17 | > import cgitb | |||
|
18 | > cgitb.enable() | |||
|
19 | > from mercurial import demandimport; demandimport.enable() | |||
|
20 | > from mercurial.hgweb import hgweb | |||
|
21 | > from mercurial.hgweb import wsgicgi | |||
|
22 | > application = hgweb('.', 'test repository') | |||
|
23 | > wsgicgi.launch(application) | |||
|
24 | > HGWEB | |||
|
25 | $ chmod 755 hgweb.cgi | |||
|
26 | ||||
|
27 | test preparation | |||
|
28 | ||||
|
29 | $ . "$TESTDIR/cgienv" | |||
|
30 | $ REQUEST_METHOD="POST"; export REQUEST_METHOD | |||
|
31 | $ CONTENT_TYPE="application/octet-stream"; export CONTENT_TYPE | |||
|
32 | $ hg bundle --all bundle.hg | |||
|
33 | 1 changesets found | |||
|
34 | $ CONTENT_LENGTH=279; export CONTENT_LENGTH; | |||
|
35 | ||||
|
36 | expect unsynced changes | |||
|
37 | ||||
|
38 | $ QUERY_STRING="cmd=unbundle&heads=0000000000000000000000000000000000000000"; export QUERY_STRING | |||
|
39 | $ python hgweb.cgi <bundle.hg >page1 2>&1 | |||
|
40 | $ cat page1 | |||
|
41 | Status: 200 Script output follows\r (esc) | |||
|
42 | Content-Type: application/mercurial-0.1\r (esc) | |||
|
43 | Content-Length: 19\r (esc) | |||
|
44 | \r (esc) | |||
|
45 | 0 | |||
|
46 | unsynced changes | |||
|
47 | ||||
|
48 | successful force push | |||
|
49 | ||||
|
50 | $ QUERY_STRING="cmd=unbundle&heads=666f726365"; export QUERY_STRING | |||
|
51 | $ python hgweb.cgi <bundle.hg >page2 2>&1 | |||
|
52 | $ cat page2 | |||
|
53 | Status: 200 Script output follows\r (esc) | |||
|
54 | Content-Type: application/mercurial-0.1\r (esc) | |||
|
55 | \r (esc) | |||
|
56 | 1 | |||
|
57 | adding changesets | |||
|
58 | adding manifests | |||
|
59 | adding file changes | |||
|
60 | added 0 changesets with 0 changes to 1 files | |||
|
61 | ||||
|
62 | successful push | |||
|
63 | ||||
|
64 | $ QUERY_STRING="cmd=unbundle&heads=f7b1eb17ad24730a1651fccd46c43826d1bbc2ac"; export QUERY_STRING | |||
|
65 | $ python hgweb.cgi <bundle.hg >page3 2>&1 | |||
|
66 | $ cat page3 | |||
|
67 | Status: 200 Script output follows\r (esc) | |||
|
68 | Content-Type: application/mercurial-0.1\r (esc) | |||
|
69 | \r (esc) | |||
|
70 | 1 | |||
|
71 | adding changesets | |||
|
72 | adding manifests | |||
|
73 | adding file changes | |||
|
74 | added 0 changesets with 0 changes to 1 files |
General Comments 0
You need to be logged in to leave comments.
Login now