tests/test-push-cgi.t
author Gilles Moris <gilles.moris@free.fr>
Sun, 20 Feb 2011 18:06:05 +0100
branchstable
changeset 13449 8b1125eb361e
parent 13397 6f9616a46f7c
child 13946 3c2f9f611ef6
permissions -rw-r--r--
test-push-http: use killdaemons.py instead of kill to avoid test unreliability
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
6f9616a46f7c tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff changeset
    62
successful push
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