wok annotate mercurial/stuff/hgwebdir.cgi @ rev 18834

Add megatools (again)
author Lucas Levrel <llevrel@yahoo.fr>
date Mon Jan 18 22:23:53 2016 +0100 (2016-01-18)
parents
children
rev   line source
pankso@29 1 #!/usr/bin/env python
pankso@29 2 #
pankso@29 3 # An example CGI script to export multiple hgweb repos, edit as necessary
pankso@29 4
pankso@29 5 # adjust python path if not a system-wide install:
pankso@29 6 #import sys
pankso@29 7 #sys.path.insert(0, "/path/to/python/lib")
pankso@29 8
pankso@29 9 # enable importing on demand to reduce startup time
pankso@29 10 from mercurial import demandimport; demandimport.enable()
pankso@29 11
pankso@29 12 # send python tracebacks to the browser if an error occurs:
pankso@29 13 import cgitb
pankso@29 14 cgitb.enable()
pankso@29 15
pankso@29 16 # If you'd like to serve pages with UTF-8 instead of your default
pankso@29 17 # locale charset, you can do so by uncommenting the following lines.
pankso@29 18 # Note that this will cause your .hgrc files to be interpreted in
pankso@29 19 # UTF-8 and all your repo files to be displayed using UTF-8.
pankso@29 20 #
pankso@29 21 #import os
pankso@29 22 #os.environ["HGENCODING"] = "UTF-8"
pankso@29 23
pankso@29 24 from mercurial.hgweb.hgwebdir_mod import hgwebdir
pankso@29 25 from mercurial.hgweb.request import wsgiapplication
pankso@29 26 import mercurial.hgweb.wsgicgi as wsgicgi
pankso@29 27
pankso@29 28 # The config file looks like this. You can have paths to individual
pankso@29 29 # repos, collections of repos in a directory tree, or both.
pankso@29 30 #
pankso@29 31 # [paths]
pankso@29 32 # virtual/path = /real/path
pankso@29 33 # virtual/path = /real/path
pankso@29 34 #
pankso@29 35 # [collections]
pankso@29 36 # /prefix/to/strip/off = /root/of/tree/full/of/repos
pankso@29 37 #
pankso@29 38 # collections example: say directory tree /foo contains repos /foo/bar,
pankso@29 39 # /foo/quux/baz. Give this config section:
pankso@29 40 # [collections]
pankso@29 41 # /foo = /foo
pankso@29 42 # Then repos will list as bar and quux/baz.
pankso@29 43 #
pankso@29 44 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
pankso@29 45 # or use a dictionary with entries like 'virtual/path': '/real/path'
pankso@29 46
pankso@29 47 def make_web_app():
pankso@29 48 return hgwebdir("/etc/mercurial/hgweb.config")
pankso@29 49
pankso@29 50 wsgicgi.launch(wsgiapplication(make_web_app))