hgweb.cgi
author Anton Shestakov <av6@dwimlabs.net>
Mon, 02 May 2022 12:10:28 +0400
changeset 49171 2c0570a6d5ae
parent 45830 c102b704edb5
child 50734 d5cd1fd690f3
permissions -rwxr-xr-x
followlines: don't put Unicode directly into the .js file (issue6559) Apparently some web server setups may serve this file in a different encoding than UTF-8, and that results in visual garbage in the followlines button that renders for every line in a file. So instead of using this Unicode character in UTF-8 we can encode it as \u2212. Or, to be more explicit, we can use &minus; HTML entity, which resolves into exactly that character. Since now we're using innerHTML property to set the minus part of the button, let's use it to set the plus part as well (even though the plus sign was plain ASCII). A wise man once said "A foolish consistency is the hobgob... eh, whatever." Throw a brick at me if this makes things worse. Differential Revision: https://phab.mercurial-scm.org/D12597

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