hgweb.cgi
author Matt Harbison <matt_harbison@yahoo.com>
Tue, 25 Apr 2023 17:49:35 -0400
branchstable
changeset 50439 f4ff55583dec
parent 45830 c102b704edb5
child 50734 d5cd1fd690f3
permissions -rwxr-xr-x
fix: highlight the required configuration and behavior of the fixer tools The problem is that `hg help fix` didn't mention *how* to configure the tools, and while I knew that `{rootpath}` existed in the configuration, I missed that the tools require reading content from stdin. (I configured `gofmt` to use `{rootpath}`, and that had the effect of squashing all changes in a file at `.` into the first commit and emptying that content from its descendants.) Basically all this does is put a pointer in the default (command level) help to the extension level help that mentions the configuration, and moves the extension level help that documents reading from stdin and writing to stdout to the top to give it more prominence. The last sentence is adjusted a bit to reflect the new location.

#!/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")

# 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)