rlm@0: #!/usr/bin/env python rlm@0: # rlm@0: # An example CGI script to export multiple hgweb repos, edit as necessary rlm@0: rlm@0: # adjust python path if not a system-wide install: rlm@0: #import sys rlm@0: #sys.path.insert(0, "/path/to/python/lib") rlm@0: rlm@0: # enable importing on demand to reduce startup time rlm@0: from mercurial import demandimport; demandimport.enable() rlm@0: rlm@0: # Uncomment to send python tracebacks to the browser if an error occurs: rlm@0: #import cgitb rlm@0: #cgitb.enable() rlm@0: rlm@0: # If you'd like to serve pages with UTF-8 instead of your default rlm@0: # locale charset, you can do so by uncommenting the following lines. rlm@0: # Note that this will cause your .hgrc files to be interpreted in rlm@0: # UTF-8 and all your repo files to be displayed using UTF-8. rlm@0: # rlm@0: #import os rlm@0: #os.environ["HGENCODING"] = "UTF-8" rlm@0: rlm@0: from mercurial.hgweb.hgwebdir_mod import hgwebdir rlm@0: import mercurial.hgweb.wsgicgi as wsgicgi rlm@0: rlm@0: # The config file looks like this. You can have paths to individual rlm@0: # repos, collections of repos in a directory tree, or both. rlm@0: # rlm@0: # [paths] rlm@0: # virtual/path1 = /real/path1 rlm@0: # virtual/path2 = /real/path2 rlm@0: # virtual/root = /real/root/* rlm@0: # / = /real/root2/* rlm@0: # virtual/root2 = /real/root2/** rlm@0: # rlm@0: # [collections] rlm@0: # /prefix/to/strip/off = /root/of/tree/full/of/repos rlm@0: # rlm@0: # paths example: rlm@0: # rlm@0: # * First two lines mount one repository into one virtual path, like rlm@0: # '/real/path1' into 'virtual/path1'. rlm@0: # rlm@0: # * The third entry mounts every mercurial repository found in '/real/root' rlm@0: # in 'virtual/root'. This format is preferred over the [collections] one, rlm@0: # since using absolute paths as configuration keys is not supported on every rlm@0: # platform (especially on Windows). rlm@0: # rlm@0: # * The fourth entry is a special case mounting all repositories in rlm@0: # /'real/root2' in the root of the virtual directory. rlm@0: # rlm@0: # * The fifth entry recursively finds all repositories under the real root, rlm@0: # and mounts them using their relative path (to given real root) under the rlm@0: # virtual root. rlm@0: # rlm@0: # collections example: say directory tree /foo contains repos /foo/bar, rlm@0: # /foo/quux/baz. Give this config section: rlm@0: # [collections] rlm@0: # /foo = /foo rlm@0: # Then repos will list as bar and quux/baz. rlm@0: # rlm@0: # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples rlm@0: # or use a dictionary with entries like 'virtual/path': '/real/path' rlm@0: rlm@0: application = hgwebdir('hgweb.config') rlm@0: wsgicgi.launch(application)