Mercurial > rlmcintyre
comparison hgwebdir.cgi @ 0:0d795f02a8bb tip
initial committ. what was I thinking?
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 27 Sep 2010 16:57:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0d795f02a8bb |
---|---|
1 #!/usr/bin/env python | |
2 # | |
3 # An example CGI script to export multiple hgweb repos, edit as necessary | |
4 | |
5 # adjust python path if not a system-wide install: | |
6 #import sys | |
7 #sys.path.insert(0, "/path/to/python/lib") | |
8 | |
9 # enable importing on demand to reduce startup time | |
10 from mercurial import demandimport; demandimport.enable() | |
11 | |
12 # Uncomment to send python tracebacks to the browser if an error occurs: | |
13 #import cgitb | |
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 import mercurial.hgweb.wsgicgi as wsgicgi | |
26 | |
27 # The config file looks like this. You can have paths to individual | |
28 # repos, collections of repos in a directory tree, or both. | |
29 # | |
30 # [paths] | |
31 # virtual/path1 = /real/path1 | |
32 # virtual/path2 = /real/path2 | |
33 # virtual/root = /real/root/* | |
34 # / = /real/root2/* | |
35 # virtual/root2 = /real/root2/** | |
36 # | |
37 # [collections] | |
38 # /prefix/to/strip/off = /root/of/tree/full/of/repos | |
39 # | |
40 # paths example: | |
41 # | |
42 # * First two lines mount one repository into one virtual path, like | |
43 # '/real/path1' into 'virtual/path1'. | |
44 # | |
45 # * The third entry mounts every mercurial repository found in '/real/root' | |
46 # in 'virtual/root'. This format is preferred over the [collections] one, | |
47 # since using absolute paths as configuration keys is not supported on every | |
48 # platform (especially on Windows). | |
49 # | |
50 # * The fourth entry is a special case mounting all repositories in | |
51 # /'real/root2' in the root of the virtual directory. | |
52 # | |
53 # * The fifth entry recursively finds all repositories under the real root, | |
54 # and mounts them using their relative path (to given real root) under the | |
55 # virtual root. | |
56 # | |
57 # collections example: say directory tree /foo contains repos /foo/bar, | |
58 # /foo/quux/baz. Give this config section: | |
59 # [collections] | |
60 # /foo = /foo | |
61 # Then repos will list as bar and quux/baz. | |
62 # | |
63 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples | |
64 # or use a dictionary with entries like 'virtual/path': '/real/path' | |
65 | |
66 application = hgwebdir('hgweb.config') | |
67 wsgicgi.launch(application) |