| 
18
 | 
     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
  | 
| 
362
 | 
     7  | 
sys.path.append("/usr/local/lib/python2.7/site-packages/")
 | 
| 
18
 | 
     8  | 
  | 
| 
 | 
     9  | 
# enable importing on demand to reduce startup time
  | 
| 
416
 | 
    10  | 
#from mercurial import demandimport; demandimport.enable()
  | 
| 
18
 | 
    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/path = /real/path
  | 
| 
 | 
    32  | 
# virtual/path = /real/path
  | 
| 
 | 
    33  | 
#
  | 
| 
 | 
    34  | 
# [collections]
  | 
| 
 | 
    35  | 
# /prefix/to/strip/off = /root/of/tree/full/of/repos
  | 
| 
 | 
    36  | 
#
  | 
| 
 | 
    37  | 
# collections example: say directory tree /foo contains repos /foo/bar,
  | 
| 
 | 
    38  | 
# /foo/quux/baz.  Give this config section:
  | 
| 
 | 
    39  | 
#   [collections]
  | 
| 
 | 
    40  | 
#   /foo = /foo
  | 
| 
 | 
    41  | 
# Then repos will list as bar and quux/baz.
  | 
| 
 | 
    42  | 
#
  | 
| 
 | 
    43  | 
# Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
 | 
| 
 | 
    44  | 
# or use a dictionary with entries like 'virtual/path': '/real/path'
  | 
| 
 | 
    45  | 
  | 
| 
20
 | 
    46  | 
application = hgwebdir('/home/staff/urbanc/HGREPOS/hgweb.config')
 | 
| 
18
 | 
    47  | 
wsgicgi.launch(application)
  |