hgweb.cgi
author Matt Harbison <matt_harbison@yahoo.com>
Tue, 17 Dec 2024 22:32:12 -0500
changeset 52545 82c8fb6a048c
parent 50731 d5cd1fd690f3
permissions -rwxr-xr-x
pyproject: lock in the major version of `black` that's required The `hghave` checks already look for an exact this minor version of this, but according to their Stability Policy[1], we can use any version with the same major number. The reason for adding this here is we don't want someone to blindly run the tool and get a different format because they were running a different major version locally. It also makes it easier to discover when the required version has changed, because that's included in the error message. If there's concern about duplication and forgetting to update one place or the other, we can pipe a trivial python statement to it, and see if it exits with a failure. FWIW, having it in the project file here is also enforced when running `test-check-format.t`. It's not enforced by the `hghave` version check, so if it gets out of sync, the test will run and print: Oh no! \xf0\x9f\x92\xa5 \xf0\x9f\x92\x94 \xf0\x9f\x92\xa5 The required version `24` does not match the running version `23.3.0`! [1] https://github.com/psf/black/blob/30759ca782429221cfb329f335e2074cb359decb/docs/the_black_code_style/index.md?plain=1#L24

#!/usr/bin/env python3
#
# 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 = b"/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")

from mercurial import demandimport

demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi

application = hgweb(config)
wsgicgi.launch(application)