Hosting Mercurial HG via VisualSVN Server

后端 未结 4 962
鱼传尺愫
鱼传尺愫 2021-02-04 20:49

I have tried to host a Mercurial HG repository using a Scriptalias.

ScriptAlias /hg/ \"htdocs/hgwebdir.cgi\"

If I go to Chrome it display the contents of the cgi

4条回答
  •  深忆病人
    2021-02-04 21:27

    Assuming you have Python 2.6 installed and working, here are the steps that I took.

    Obtain "mod_cgi.so" built for Apache 2.2 Win32 and place it in "C:\Program Files\VisualSVN Server\bin".

    Paste the following in "C:\Program Files\VisualSVN Server\conf\httpd-custom.conf"

    LoadModule cgi_module bin/mod_cgi.so
    ScriptAliasMatch ^/hg(.*) "cgi-bin/hgweb.cgi$1"
    

    Create the cgi-bin directory, "C:\Program Files\VisualSVN Server\cgi-bin". And place hgweb.cgi in it. Make sure it looks similar to the following:

    #!c:/Python26/python.exe -u
    
    import sys
    sys.path.insert(0, "C:\Program Files\Mercurial\library")
    
    import cgitb
    cgitb.enable()
    
    from mercurial.hgweb.hgwebdir_mod import hgwebdir
    import mercurial.hgweb.wsgicgi as wsgicgi
    
    application = hgwebdir('hgweb.config')
    wsgicgi.launch(application)
    

    Create a file called hgweb.config in the cgi-bin directory.

    [paths]
    / = c:/HgRepositories/*
    

    Copied "C:\Program Files\Mercurial\templates" to "C:\Program Files\Mercurial\library\templates".

    Create "C:\HgRepositories" folder and "hg init c:\HgRepositories\test".

    Restart VisualSVN Server, open browser, enjoy your Mercurial repository.

提交回复
热议问题