Mercurial browser on Windows 2003 takes several refreshes before displaying repositories
Posted
by Tim Murphy
on Server Fault
See other posts from Server Fault
or by Tim Murphy
Published on 2010-06-16T23:04:23Z
Indexed on
2010/06/16
23:13 UTC
Read the original article
Hit count: 344
When attempt to browse my Mercurial repositories it usually takes several refreshes before the repository list is displayed. The configuration is as follows:
- Windows Server 2003 (Dedicated machine hosted by http://www.server4you.com/.
- Site has anonymous password protection with self-signed SSL.
- Mercurial 1.5.3
- Python 2.6.5
- Python for Windows 32 extensions 214 py2.6
- isapi-wsgi 0.4.2
The repositories are being served via ISAPI using the standard hgwebdir_wspi.py file (copy to follow).
Other problems with the repository server:
- Before doing a clone/push/etc I have to browse the repositories first otherwise hg on my local machine can not locate the site.
- I have one a repository with a large changeset that after a minute or so throw error "abort: error: An existing connection was forcibly closed by the remote host". Will be asking another question for this problem.
What can I do to start tracking down this problem?
hgwebdir_wsgi.py
# Configuration file location
hgweb_config = r'C:\Public\Mercurial\WebSite\hgweb.config'
# Global settings for IIS path translation
path_strip = 0 # Strip this many path elements off (when using url rewrite)
path_prefix = 0 # This many path elements are prefixes (depends on the
# virtual path of the IIS application).
import sys
# Adjust python path if this is not a system-wide install
#sys.path.insert(0, r'c:\path\to\python\lib')
# Enable tracing. Run 'python -m win32traceutil' to debug
if hasattr(sys, 'isapidllhandle'):
import win32traceutil
# To serve pages in local charset instead of UTF-8, remove the two lines below
import os
os.environ['HGENCODING'] = 'UTF-8'
import isapi_wsgi
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb.hgwebdir_mod import hgwebdir
# Example tweak: Replace isapi_wsgi's handler to provide better error message
# Other stuff could also be done here, like logging errors etc.
class WsgiHandler(isapi_wsgi.IsapiWsgiHandler):
error_status = '500 Internal Server Error' # less silly error message
isapi_wsgi.IsapiWsgiHandler = WsgiHandler
# Only create the hgwebdir instance once
application = hgwebdir(hgweb_config)
def handler(environ, start_response):
# Translate IIS's weird URLs
url = environ['SCRIPT_NAME'] + environ['PATH_INFO']
paths = url[1:].split('/')[path_strip:]
script_name = '/' + '/'.join(paths[:path_prefix])
path_info = '/'.join(paths[path_prefix:])
if path_info:
path_info = '/' + path_info
environ['SCRIPT_NAME'] = script_name
environ['PATH_INFO'] = path_info
return application(environ, start_response)
def __ExtensionFactory__():
return isapi_wsgi.ISAPISimpleHandler(handler)
if __name__=='__main__':
from isapi.install import *
params = ISAPIParameters()
HandleCommandLine(params)
hgweb.config
[paths]
/ = C:\Public\Mercurial\Repositories\*
[web]
allow_archive = bz2 gz zip ; Allows archive downloads.
allow_push = ######## ; Users that are allowed to push.
© Server Fault or respective owner