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