annotate deploy/config/index.cgi @ 1628:9c5f8e24dadc live tip

Quieten this cron script
author Chris Cannam
date Tue, 25 Aug 2020 11:38:49 +0100
parents f3144e23ca1d
children
rev   line source
Chris@1576 1 #!/usr/bin/env python
Chris@1576 2 #
Chris@1576 3 # An example CGI script to export multiple hgweb repos, edit as necessary
Chris@1576 4
Chris@1576 5 # adjust python path if not a system-wide install:
Chris@1576 6 #import sys
Chris@1576 7 #sys.path.insert(0, "/path/to/python/lib")
Chris@1576 8
Chris@1576 9 # enable importing on demand to reduce startup time
Chris@1576 10 from mercurial import demandimport; demandimport.enable()
Chris@1576 11
Chris@1576 12 # Uncomment to send python tracebacks to the browser if an error occurs:
Chris@1622 13 #import cgitb
Chris@1622 14 #cgitb.enable()
Chris@1576 15
Chris@1576 16 # If you'd like to serve pages with UTF-8 instead of your default
Chris@1576 17 # locale charset, you can do so by uncommenting the following lines.
Chris@1576 18 # Note that this will cause your .hgrc files to be interpreted in
Chris@1576 19 # UTF-8 and all your repo files to be displayed using UTF-8.
Chris@1576 20 #
Chris@1576 21 import os
Chris@1576 22 os.environ["HGENCODING"] = "UTF-8"
Chris@1576 23
Chris@1576 24 from mercurial.hgweb.hgwebdir_mod import hgwebdir
Chris@1576 25 import mercurial.hgweb.wsgicgi as wsgicgi
Chris@1576 26
Chris@1576 27 # The config file looks like this. You can have paths to individual
Chris@1576 28 # repos, collections of repos in a directory tree, or both.
Chris@1576 29 #
Chris@1576 30 # [paths]
Chris@1576 31 # virtual/path1 = /real/path1
Chris@1576 32 # virtual/path2 = /real/path2
Chris@1576 33 # virtual/root = /real/root/*
Chris@1576 34 # / = /real/root2/*
Chris@1576 35 # virtual/root2 = /real/root2/**
Chris@1576 36 #
Chris@1576 37 # [collections]
Chris@1576 38 # /prefix/to/strip/off = /root/of/tree/full/of/repos
Chris@1576 39 #
Chris@1576 40 # paths example:
Chris@1576 41 #
Chris@1576 42 # * First two lines mount one repository into one virtual path, like
Chris@1576 43 # '/real/path1' into 'virtual/path1'.
Chris@1576 44 #
Chris@1576 45 # * The third entry mounts every mercurial repository found in '/real/root'
Chris@1576 46 # in 'virtual/root'. This format is preferred over the [collections] one,
Chris@1576 47 # since using absolute paths as configuration keys is not supported on every
Chris@1576 48 # platform (especially on Windows).
Chris@1576 49 #
Chris@1576 50 # * The fourth entry is a special case mounting all repositories in
Chris@1576 51 # /'real/root2' in the root of the virtual directory.
Chris@1576 52 #
Chris@1576 53 # * The fifth entry recursively finds all repositories under the real root,
Chris@1576 54 # and mounts them using their relative path (to given real root) under the
Chris@1576 55 # virtual root.
Chris@1576 56 #
Chris@1576 57 # collections example: say directory tree /foo contains repos /foo/bar,
Chris@1576 58 # /foo/quux/baz. Give this config section:
Chris@1576 59 # [collections]
Chris@1576 60 # /foo = /foo
Chris@1576 61 # Then repos will list as bar and quux/baz.
Chris@1576 62 #
Chris@1576 63 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
Chris@1576 64 # or use a dictionary with entries like 'virtual/path': '/real/path'
Chris@1576 65
Chris@1576 66 application = hgwebdir('hgweb.config')
Chris@1576 67 wsgicgi.launch(application)