view hgweb.cgi @ 39762:edaa40dc5fe5

py3: create built in exceptions with str type messages in win32.py I hit an IOError in unlink() in test-pathconflicts-basic.t, that then crashed as it was handled: File "mercurial\dispatch.py", line 359, in _runcatch return _callcatch(ui, _runcatchfunc) File "mercurial\dispatch.py", line 367, in _callcatch return scmutil.callcatch(ui, func) File "mercurial\scmutil.py", line 252, in callcatch ui.error(_("abort: %s\n") % encoding.strtolocal(inst.strerror)) File "mercurial\encoding.py", line 205, in unitolocal return tolocal(u.encode('utf-8')) AttributeError: 'bytes' object has no attribute 'encode'
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 21 Sep 2018 21:44:27 -0400
parents 4b0fc75f9403
children 47ef023d0165
line wrap: on
line source

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