Help to translate cgi script to wsgi

Igor Kostenko isanych at gmail.com
Tue Sep 2 23:21:20 CDT 2008


Hello all,

I have a simple cgi script which sync repositories:

import sys, os, datetime
from mercurial import demandimport; demandimport.enable()

print "Status: 200 Script output follows"
print "content-type: text/plain"
print "Cache-Control: no-cache"
print "Expires: -1"
print "Pragma: no-cache\n";

from mercurial import util
import mercurial.dispatch

roots = 'C:\D\hg'
if isinstance(roots, basestring):
    roots = (roots,)
for root in roots:    
    normalroot = os.path.normpath(root)
    for path in util.walkrepos(root):
        repo = os.path.normpath(path)
        name = repo[len(normalroot):].lstrip(os.sep)
        print datetime.datetime.now(), name
        os.chdir(path)
        mercurial.dispatch.dispatch(['pull'])
        mercurial.dispatch.dispatch(['push'])
print datetime.datetime.now(), "finish"

After upgrade mercurial from 0.9.5 to 1.0.2 i cannot execute it from apache on 
windows - python crashed with memory could not be read error. I suspect that 
wsgi variant will work.

Could anyone help to translate in to wsgi?

WBR, Igor



More information about the Mercurial mailing list