Show More
@@ -1,102 +1,100 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | hg init test |
|
3 | hg init test | |
4 |
|
4 | |||
5 | cat >hgweb.cgi <<HGWEB |
|
5 | cat >hgweb.cgi <<HGWEB | |
6 | #!/usr/bin/env python |
|
6 | #!/usr/bin/env python | |
7 | # |
|
7 | # | |
8 | # An example CGI script to use hgweb, edit as necessary |
|
8 | # An example CGI script to use hgweb, edit as necessary | |
9 |
|
9 | |||
10 | import cgitb, os, sys |
|
10 | import cgitb, os, sys | |
11 | cgitb.enable() |
|
11 | cgitb.enable() | |
12 |
|
12 | |||
13 | # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install |
|
13 | # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install | |
14 | from mercurial import hgweb |
|
14 | from mercurial import hgweb | |
15 |
|
15 | |||
16 | h = hgweb.hgweb("test", "Empty test repository") |
|
16 | h = hgweb.hgweb("test", "Empty test repository") | |
17 | h.run() |
|
17 | h.run() | |
18 | HGWEB |
|
18 | HGWEB | |
19 | chmod 755 hgweb.cgi |
|
19 | chmod 755 hgweb.cgi | |
20 |
|
20 | |||
21 | cat >hgweb.config <<HGWEBDIRCONF |
|
21 | cat >hgweb.config <<HGWEBDIRCONF | |
22 | [paths] |
|
22 | [paths] | |
23 | test = test |
|
23 | test = test | |
24 | HGWEBDIRCONF |
|
24 | HGWEBDIRCONF | |
25 |
|
25 | |||
26 | cat >hgwebdir.cgi <<HGWEBDIR |
|
26 | cat >hgwebdir.cgi <<HGWEBDIR | |
27 | #!/usr/bin/env python |
|
27 | #!/usr/bin/env python | |
28 | # |
|
28 | # | |
29 | # An example CGI script to export multiple hgweb repos, edit as necessary |
|
29 | # An example CGI script to export multiple hgweb repos, edit as necessary | |
30 |
|
30 | |||
31 | import cgitb, sys |
|
31 | import cgitb, sys | |
32 | cgitb.enable() |
|
32 | cgitb.enable() | |
33 |
|
33 | |||
34 | # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install |
|
34 | # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install | |
35 | from mercurial import hgweb |
|
35 | from mercurial import hgweb | |
36 |
|
36 | |||
37 | # The config file looks like this. You can have paths to individual |
|
37 | # The config file looks like this. You can have paths to individual | |
38 | # repos, collections of repos in a directory tree, or both. |
|
38 | # repos, collections of repos in a directory tree, or both. | |
39 | # |
|
39 | # | |
40 | # [paths] |
|
40 | # [paths] | |
41 | # virtual/path = /real/path |
|
41 | # virtual/path = /real/path | |
42 | # virtual/path = /real/path |
|
42 | # virtual/path = /real/path | |
43 | # |
|
43 | # | |
44 | # [collections] |
|
44 | # [collections] | |
45 | # /prefix/to/strip/off = /root/of/tree/full/of/repos |
|
45 | # /prefix/to/strip/off = /root/of/tree/full/of/repos | |
46 | # |
|
46 | # | |
47 | # collections example: say directory tree /foo contains repos /foo/bar, |
|
47 | # collections example: say directory tree /foo contains repos /foo/bar, | |
48 | # /foo/quux/baz. Give this config section: |
|
48 | # /foo/quux/baz. Give this config section: | |
49 | # [collections] |
|
49 | # [collections] | |
50 | # /foo = /foo |
|
50 | # /foo = /foo | |
51 | # Then repos will list as bar and quux/baz. |
|
51 | # Then repos will list as bar and quux/baz. | |
52 |
|
52 | |||
53 | # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples |
|
53 | # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples | |
54 | # or use a dictionary with entries like 'virtual/path': '/real/path' |
|
54 | # or use a dictionary with entries like 'virtual/path': '/real/path' | |
55 |
|
55 | |||
56 | h = hgweb.hgwebdir("hgweb.config") |
|
56 | h = hgweb.hgwebdir("hgweb.config") | |
57 | h.run() |
|
57 | h.run() | |
58 | HGWEBDIR |
|
58 | HGWEBDIR | |
59 | chmod 755 hgwebdir.cgi |
|
59 | chmod 755 hgwebdir.cgi | |
60 |
|
60 | |||
61 | DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT |
|
61 | DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT | |
62 | GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE |
|
62 | GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE | |
63 | HTTP_ACCEPT="text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; export HTTP_ACCEPT |
|
63 | HTTP_ACCEPT="text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; export HTTP_ACCEPT | |
64 | HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET |
|
64 | HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET | |
65 | HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING |
|
65 | HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING | |
66 | HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE |
|
66 | HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE | |
67 | HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL |
|
67 | HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL | |
68 | HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION |
|
68 | HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION | |
69 | HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST |
|
69 | HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST | |
70 | HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE |
|
70 | HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE | |
71 | HTTP_USER_AGENT="Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.4) Gecko/20060608 Ubuntu/dapper-security Firefox/1.5.0.4"; export HTTP_USER_AGENT |
|
71 | HTTP_USER_AGENT="Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.4) Gecko/20060608 Ubuntu/dapper-security Firefox/1.5.0.4"; export HTTP_USER_AGENT | |
72 | PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"; export PATH |
|
|||
73 | PATH_INFO="/"; export PATH_INFO |
|
72 | PATH_INFO="/"; export PATH_INFO | |
74 | PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED |
|
73 | PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED | |
75 | PWD="/home/hopper/hg_public"; export PWD |
|
|||
76 | QUERY_STRING=""; export QUERY_STRING |
|
74 | QUERY_STRING=""; export QUERY_STRING | |
77 | REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR |
|
75 | REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR | |
78 | REMOTE_PORT="44703"; export REMOTE_PORT |
|
76 | REMOTE_PORT="44703"; export REMOTE_PORT | |
79 | REQUEST_METHOD="GET"; export REQUEST_METHOD |
|
77 | REQUEST_METHOD="GET"; export REQUEST_METHOD | |
80 | REQUEST_URI="/test/"; export REQUEST_URI |
|
78 | REQUEST_URI="/test/"; export REQUEST_URI | |
81 | SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME |
|
79 | SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME | |
82 | SCRIPT_NAME="/test"; export SCRIPT_NAME |
|
80 | SCRIPT_NAME="/test"; export SCRIPT_NAME | |
83 | SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI |
|
81 | SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI | |
84 | SCRIPT_URL="/test/"; export SCRIPT_URL |
|
82 | SCRIPT_URL="/test/"; export SCRIPT_URL | |
85 | SERVER_ADDR="127.0.0.1"; export SERVER_ADDR |
|
83 | SERVER_ADDR="127.0.0.1"; export SERVER_ADDR | |
86 | SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN |
|
84 | SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN | |
87 | SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME |
|
85 | SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME | |
88 | SERVER_PORT="80"; export SERVER_PORT |
|
86 | SERVER_PORT="80"; export SERVER_PORT | |
89 | SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL |
|
87 | SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL | |
90 | SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>\; export SERVER_SIGNATURE |
|
88 | SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>\; export SERVER_SIGNATURE | |
91 | " |
|
89 | " | |
92 | SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE |
|
90 | SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE | |
93 | ./hgweb.cgi >page1 2>&1 ; echo $? |
|
91 | ./hgweb.cgi >page1 2>&1 ; echo $? | |
94 | ./hgwebdir.cgi >page2 2>&1 ; echo $? |
|
92 | ./hgwebdir.cgi >page2 2>&1 ; echo $? | |
95 | PATH_INFO="/test/" |
|
93 | PATH_INFO="/test/" | |
96 | PATH_TRANSLATED="/var/something/test.cgi" |
|
94 | PATH_TRANSLATED="/var/something/test.cgi" | |
97 | REQUEST_URI="/test/test/" |
|
95 | REQUEST_URI="/test/test/" | |
98 | SCRIPT_URI="http://hg.omnifarious.org/test/test/" |
|
96 | SCRIPT_URI="http://hg.omnifarious.org/test/test/" | |
99 | SCRIPT_URL="/test/test/" |
|
97 | SCRIPT_URL="/test/test/" | |
100 | ./hgwebdir.cgi >page3 2>&1 ; echo $? |
|
98 | ./hgwebdir.cgi >page3 2>&1 ; echo $? | |
101 | fgrep -i error page1 page2 page3 && exit 1 |
|
99 | fgrep -i error page1 page2 page3 && exit 1 | |
102 | exit 0 |
|
100 | exit 0 |
General Comments 0
You need to be logged in to leave comments.
Login now