Mercurial > hg
annotate tests/test-push-cgi.t @ 14889:a59058fd074a stable
hooks: redirect stdout/err/in to the ui descriptors when calling python hooks
We need to make sure that python hooks I/O goes through the ui descriptors so
it doesn't mess the command server protocol.
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Sat, 09 Jul 2011 19:06:59 +0300 |
parents | 3c2f9f611ef6 |
children | 8b84d040d9f9 |
rev | line source |
---|---|
13397
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
1 This is a test of the push wire protocol over CGI-based hgweb. |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
2 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
3 initialize repository |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
4 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
5 $ hg init r |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
6 $ cd r |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
7 $ echo a > a |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
8 $ hg ci -A -m "0" |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
9 adding a |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
10 $ echo '[web]' > .hg/hgrc |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
11 $ echo 'allow_push = *' >> .hg/hgrc |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
12 $ echo 'push_ssl = false' >> .hg/hgrc |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
13 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
14 create hgweb invocation script |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
15 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
16 $ cat >hgweb.cgi <<HGWEB |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
17 > import cgitb |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
18 > cgitb.enable() |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
19 > from mercurial import demandimport; demandimport.enable() |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
20 > from mercurial.hgweb import hgweb |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
21 > from mercurial.hgweb import wsgicgi |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
22 > application = hgweb('.', 'test repository') |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
23 > wsgicgi.launch(application) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
24 > HGWEB |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
25 $ chmod 755 hgweb.cgi |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
26 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
27 test preparation |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
28 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
29 $ . "$TESTDIR/cgienv" |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
30 $ REQUEST_METHOD="POST"; export REQUEST_METHOD |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
31 $ CONTENT_TYPE="application/octet-stream"; export CONTENT_TYPE |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
32 $ hg bundle --all bundle.hg |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
33 1 changesets found |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
34 $ CONTENT_LENGTH=279; export CONTENT_LENGTH; |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
35 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
36 expect unsynced changes |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
37 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
38 $ QUERY_STRING="cmd=unbundle&heads=0000000000000000000000000000000000000000"; export QUERY_STRING |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
39 $ python hgweb.cgi <bundle.hg >page1 2>&1 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
40 $ cat page1 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
41 Status: 200 Script output follows\r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
42 Content-Type: application/mercurial-0.1\r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
43 Content-Length: 19\r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
44 \r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
45 0 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
46 unsynced changes |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
47 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
48 successful force push |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
49 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
50 $ QUERY_STRING="cmd=unbundle&heads=666f726365"; export QUERY_STRING |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
51 $ python hgweb.cgi <bundle.hg >page2 2>&1 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
52 $ cat page2 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
53 Status: 200 Script output follows\r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
54 Content-Type: application/mercurial-0.1\r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
55 \r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
56 1 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
57 adding changesets |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
58 adding manifests |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
59 adding file changes |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
60 added 0 changesets with 0 changes to 1 files |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
61 |
13946
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
62 successful push, list of heads |
13397
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
63 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
64 $ QUERY_STRING="cmd=unbundle&heads=f7b1eb17ad24730a1651fccd46c43826d1bbc2ac"; export QUERY_STRING |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
65 $ python hgweb.cgi <bundle.hg >page3 2>&1 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
66 $ cat page3 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
67 Status: 200 Script output follows\r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
68 Content-Type: application/mercurial-0.1\r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
69 \r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
70 1 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
71 adding changesets |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
72 adding manifests |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
73 adding file changes |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
74 added 0 changesets with 0 changes to 1 files |
13946
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
75 |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
76 successful push, SHA1 hash of heads (unbundlehash capability) |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
77 |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
78 $ QUERY_STRING="cmd=unbundle&heads=686173686564 5a785a5f9e0d433b88ed862b206b011b0c3a9d13"; export QUERY_STRING |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
79 $ python hgweb.cgi <bundle.hg >page4 2>&1 |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
80 $ cat page4 |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
81 Status: 200 Script output follows\r (esc) |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
82 Content-Type: application/mercurial-0.1\r (esc) |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
83 \r (esc) |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
84 1 |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
85 adding changesets |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
86 adding manifests |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
87 adding file changes |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
88 added 0 changesets with 0 changes to 1 files |