hgweb.cgi
author John Mulligan <phlogistonjohn@asynchrono.us>
Thu, 09 Feb 2017 15:20:41 -0500
changeset 30923 78de43ab585f
parent 26421 4b0fc75f9403
child 43691 47ef023d0165
permissions -rwxr-xr-x
bugzilla: add a rest api backend (usable with bugzilla 5.0+) Add support for the bugzilla rest api documented at https://wiki.mozilla.org/Bugzilla:REST_API and at https://bugzilla.readthedocs.io/en/latest/ This backend has the following benefits: * It supports the bugzilla api keys so hgrc does not need to contain a user's bugzilla password * Works with Mercurial's "hostfingerprints" support making handling bugzilla instances with self-signed certs easier * Does not use xmlrpc ;-) Adds configuration item 'apikey' in [bugzilla] section. My major concern with these patches is if the approach to HTTP access is the right way for an extension and if hooking into request object and the overriding the get_method to perform PUT requests was a sensible approach. # no-check-commit

#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary
# See also https://mercurial-scm.org/wiki/PublishingRepositories

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/path/to/repo/or/config"

# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
#import sys; sys.path.insert(0, "/path/to/python/lib")

# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)