| 1 |
#require no-msys # MSYS will translate web paths as if they were file paths |
| 2 |
|
| 3 |
This is a test of the push wire protocol over CGI-based hgweb. |
| 4 |
|
| 5 |
initialize repository |
| 6 |
|
| 7 |
$ hg init r |
| 8 |
$ cd r |
| 9 |
$ echo a > a |
| 10 |
$ hg ci -A -m "0" |
| 11 |
adding a |
| 12 |
$ echo '[web]' > .hg/hgrc |
| 13 |
$ echo 'allow_push = *' >> .hg/hgrc |
| 14 |
$ echo 'push_ssl = false' >> .hg/hgrc |
| 15 |
|
| 16 |
create hgweb invocation script |
| 17 |
|
| 18 |
$ cat >hgweb.cgi <<HGWEB |
| 19 |
> from mercurial import demandimport; demandimport.enable() |
| 20 |
> from mercurial.hgweb import hgweb |
| 21 |
> from mercurial.hgweb import wsgicgi |
| 22 |
> application = hgweb(b'.', b'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 --type v1 --all bundle.hg |
| 33 |
1 changesets found |
| 34 |
$ CONTENT_LENGTH=279; export CONTENT_LENGTH; |
| 35 |
|
| 36 |
expect failure because heads doesn't match (formerly known as '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: 64\r (esc) |
| 44 |
\r (esc) |
| 45 |
0 |
| 46 |
repository changed while preparing changes - please try again |
| 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 |
Content-Length: 102\r (esc) |
| 56 |
\r (esc) |
| 57 |
1 |
| 58 |
adding changesets |
| 59 |
adding manifests |
| 60 |
adding file changes |
| 61 |
added 0 changesets with 0 changes to 1 files |
| 62 |
|
| 63 |
successful push, list of heads |
| 64 |
|
| 65 |
$ QUERY_STRING="cmd=unbundle&heads=f7b1eb17ad24730a1651fccd46c43826d1bbc2ac"; export QUERY_STRING |
| 66 |
$ "$PYTHON" hgweb.cgi <bundle.hg >page3 2>&1 |
| 67 |
$ cat page3 |
| 68 |
Status: 200 Script output follows\r (esc) |
| 69 |
Content-Type: application/mercurial-0.1\r (esc) |
| 70 |
Content-Length: 102\r (esc) |
| 71 |
\r (esc) |
| 72 |
1 |
| 73 |
adding changesets |
| 74 |
adding manifests |
| 75 |
adding file changes |
| 76 |
added 0 changesets with 0 changes to 1 files |
| 77 |
|
| 78 |
successful push, SHA1 hash of heads (unbundlehash capability) |
| 79 |
|
| 80 |
$ QUERY_STRING="cmd=unbundle&heads=686173686564 5a785a5f9e0d433b88ed862b206b011b0c3a9d13"; export QUERY_STRING |
| 81 |
$ "$PYTHON" hgweb.cgi <bundle.hg >page4 2>&1 |
| 82 |
$ cat page4 |
| 83 |
Status: 200 Script output follows\r (esc) |
| 84 |
Content-Type: application/mercurial-0.1\r (esc) |
| 85 |
Content-Length: 102\r (esc) |
| 86 |
\r (esc) |
| 87 |
1 |
| 88 |
adding changesets |
| 89 |
adding manifests |
| 90 |
adding file changes |
| 91 |
added 0 changesets with 0 changes to 1 files |
| 92 |
|
| 93 |
$ cd .. |