Mercurial > rlmcintyre
diff 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 |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/hgwebdir.cgi Mon Sep 27 16:57:26 2010 -0400 1.3 @@ -0,0 +1,67 @@ 1.4 +#!/usr/bin/env python 1.5 +# 1.6 +# An example CGI script to export multiple hgweb repos, edit as necessary 1.7 + 1.8 +# adjust python path if not a system-wide install: 1.9 +#import sys 1.10 +#sys.path.insert(0, "/path/to/python/lib") 1.11 + 1.12 +# enable importing on demand to reduce startup time 1.13 +from mercurial import demandimport; demandimport.enable() 1.14 + 1.15 +# Uncomment to send python tracebacks to the browser if an error occurs: 1.16 +#import cgitb 1.17 +#cgitb.enable() 1.18 + 1.19 +# If you'd like to serve pages with UTF-8 instead of your default 1.20 +# locale charset, you can do so by uncommenting the following lines. 1.21 +# Note that this will cause your .hgrc files to be interpreted in 1.22 +# UTF-8 and all your repo files to be displayed using UTF-8. 1.23 +# 1.24 +#import os 1.25 +#os.environ["HGENCODING"] = "UTF-8" 1.26 + 1.27 +from mercurial.hgweb.hgwebdir_mod import hgwebdir 1.28 +import mercurial.hgweb.wsgicgi as wsgicgi 1.29 + 1.30 +# The config file looks like this. You can have paths to individual 1.31 +# repos, collections of repos in a directory tree, or both. 1.32 +# 1.33 +# [paths] 1.34 +# virtual/path1 = /real/path1 1.35 +# virtual/path2 = /real/path2 1.36 +# virtual/root = /real/root/* 1.37 +# / = /real/root2/* 1.38 +# virtual/root2 = /real/root2/** 1.39 +# 1.40 +# [collections] 1.41 +# /prefix/to/strip/off = /root/of/tree/full/of/repos 1.42 +# 1.43 +# paths example: 1.44 +# 1.45 +# * First two lines mount one repository into one virtual path, like 1.46 +# '/real/path1' into 'virtual/path1'. 1.47 +# 1.48 +# * The third entry mounts every mercurial repository found in '/real/root' 1.49 +# in 'virtual/root'. This format is preferred over the [collections] one, 1.50 +# since using absolute paths as configuration keys is not supported on every 1.51 +# platform (especially on Windows). 1.52 +# 1.53 +# * The fourth entry is a special case mounting all repositories in 1.54 +# /'real/root2' in the root of the virtual directory. 1.55 +# 1.56 +# * The fifth entry recursively finds all repositories under the real root, 1.57 +# and mounts them using their relative path (to given real root) under the 1.58 +# virtual root. 1.59 +# 1.60 +# collections example: say directory tree /foo contains repos /foo/bar, 1.61 +# /foo/quux/baz. Give this config section: 1.62 +# [collections] 1.63 +# /foo = /foo 1.64 +# Then repos will list as bar and quux/baz. 1.65 +# 1.66 +# Alternatively you can pass a list of ('virtual/path', '/real/path') tuples 1.67 +# or use a dictionary with entries like 'virtual/path': '/real/path' 1.68 + 1.69 +application = hgwebdir('hgweb.config') 1.70 +wsgicgi.launch(application)