Show More
@@ -1,66 +1,62 | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 | # |
|
2 | # | |
3 | # An example CGI script to export multiple hgweb repos, edit as necessary |
|
3 | # An example CGI script to export multiple hgweb repos, edit as necessary | |
4 |
|
4 | |||
5 | # adjust python path if not a system-wide install: |
|
5 | # adjust python path if not a system-wide install: | |
6 | #import sys |
|
6 | #import sys | |
7 | #sys.path.insert(0, "/path/to/python/lib") |
|
7 | #sys.path.insert(0, "/path/to/python/lib") | |
8 |
|
8 | |||
9 | # enable demandloading to reduce startup time |
|
9 | # enable demandloading to reduce startup time | |
10 | from mercurial import demandimport; demandimport.enable() |
|
10 | from mercurial import demandimport; demandimport.enable() | |
11 |
|
11 | |||
12 | # Uncomment to send python tracebacks to the browser if an error occurs: |
|
12 | # Uncomment to send python tracebacks to the browser if an error occurs: | |
13 | #import cgitb |
|
13 | #import cgitb | |
14 | #cgitb.enable() |
|
14 | #cgitb.enable() | |
15 |
|
15 | |||
16 | # If you'd like to serve pages with UTF-8 instead of your default |
|
16 | # If you'd like to serve pages with UTF-8 instead of your default | |
17 | # locale charset, you can do so by uncommenting the following lines. |
|
17 | # locale charset, you can do so by uncommenting the following lines. | |
18 | # Note that this will cause your .hgrc files to be interpreted in |
|
18 | # Note that this will cause your .hgrc files to be interpreted in | |
19 | # UTF-8 and all your repo files to be displayed using UTF-8. |
|
19 | # UTF-8 and all your repo files to be displayed using UTF-8. | |
20 | # |
|
20 | # | |
21 | #import os |
|
21 | #import os | |
22 | #os.environ["HGENCODING"] = "UTF-8" |
|
22 | #os.environ["HGENCODING"] = "UTF-8" | |
23 |
|
23 | |||
24 | from mercurial.hgweb.hgwebdir_mod import hgwebdir |
|
24 | from mercurial.hgweb.hgwebdir_mod import hgwebdir | |
25 | from mercurial.hgweb.request import wsgiapplication |
|
|||
26 | from flup.server.fcgi import WSGIServer |
|
25 | from flup.server.fcgi import WSGIServer | |
27 |
|
26 | |||
28 | # The config file looks like this. You can have paths to individual |
|
27 | # The config file looks like this. You can have paths to individual | |
29 | # repos, collections of repos in a directory tree, or both. |
|
28 | # repos, collections of repos in a directory tree, or both. | |
30 | # |
|
29 | # | |
31 | # [paths] |
|
30 | # [paths] | |
32 | # virtual/path1 = /real/path1 |
|
31 | # virtual/path1 = /real/path1 | |
33 | # virtual/path2 = /real/path2 |
|
32 | # virtual/path2 = /real/path2 | |
34 | # virtual/root = /real/root/* |
|
33 | # virtual/root = /real/root/* | |
35 | # / = /real/root2/* |
|
34 | # / = /real/root2/* | |
36 | # |
|
35 | # | |
37 | # [collections] |
|
36 | # [collections] | |
38 | # /prefix/to/strip/off = /root/of/tree/full/of/repos |
|
37 | # /prefix/to/strip/off = /root/of/tree/full/of/repos | |
39 | # |
|
38 | # | |
40 | # paths example: |
|
39 | # paths example: | |
41 | # |
|
40 | # | |
42 | # * First two lines mount one repository into one virtual path, like |
|
41 | # * First two lines mount one repository into one virtual path, like | |
43 | # '/real/path1' into 'virtual/path1'. |
|
42 | # '/real/path1' into 'virtual/path1'. | |
44 | # |
|
43 | # | |
45 | # * The third entry tells every mercurial repository found in |
|
44 | # * The third entry tells every mercurial repository found in | |
46 | # '/real/root', recursively, should be mounted in 'virtual/root'. This |
|
45 | # '/real/root', recursively, should be mounted in 'virtual/root'. This | |
47 | # format is preferred over the [collections] one, using absolute paths |
|
46 | # format is preferred over the [collections] one, using absolute paths | |
48 | # as configuration keys is not supported on every platform (including |
|
47 | # as configuration keys is not supported on every platform (including | |
49 | # Windows). |
|
48 | # Windows). | |
50 | # |
|
49 | # | |
51 | # * The last entry is a special case mounting all repositories in |
|
50 | # * The last entry is a special case mounting all repositories in | |
52 | # '/real/root2' in the root of the virtual directory. |
|
51 | # '/real/root2' in the root of the virtual directory. | |
53 | # |
|
52 | # | |
54 | # collections example: say directory tree /foo contains repos /foo/bar, |
|
53 | # collections example: say directory tree /foo contains repos /foo/bar, | |
55 | # /foo/quux/baz. Give this config section: |
|
54 | # /foo/quux/baz. Give this config section: | |
56 | # [collections] |
|
55 | # [collections] | |
57 | # /foo = /foo |
|
56 | # /foo = /foo | |
58 | # Then repos will list as bar and quux/baz. |
|
57 | # Then repos will list as bar and quux/baz. | |
59 | # |
|
58 | # | |
60 | # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples |
|
59 | # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples | |
61 | # or use a dictionary with entries like 'virtual/path': '/real/path' |
|
60 | # or use a dictionary with entries like 'virtual/path': '/real/path' | |
62 |
|
61 | |||
63 | def make_web_app(): |
|
62 | WSGIServer(hgwebdir('hgweb.config')).run() | |
64 | return hgwebdir("hgweb.config") |
|
|||
65 |
|
||||
66 | WSGIServer(wsgiapplication(make_web_app)).run() |
|
General Comments 0
You need to be logged in to leave comments.
Login now