5

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 file. In IE it does render however images and links are not displayed. In either case the repository I want to display is not shown.

Has anyone managed to get this working with VisualSVN? Also will this work if I have windows authentication and https?

4

4 回答 4

6

这是使用 mod_wsgi(快!)的替代设置,组合存储库目录,您可以从 VisualSVN 服务器 GUI 管理 Mercurial 存储库级别访问。

为 Apache 2.2 Win32下载mod_wsgi.so并放置在“C:\Program Files\VisualSVN Server\bin”中。

将 hgwebdir.wsgi 从 Mercurial 安装(contrib 目录)复制到“C:\Program Files\VisualSVN Server\”。它应该看起来像这样:

import sys
sys.path.insert(0, "C:\Program Files\Mercurial\library")
from mercurial.hgweb.hgwebdir_mod import hgwebdir
application = hgwebdir('hgweb.config')

创建配置文件“C:\Program Files\VisualSVN Server\hgweb.config”。

[paths]
/ = c:/Repositories/*

将以下内容粘贴到“C:\Program Files\VisualSVN Server\conf\httpd-custom.conf”中。您应该根据 httpd.conf 的部分调整 Auth* 值。

LoadModule wsgi_module bin/mod_wsgi.so
WSGIScriptAlias /hg "hgwebdir.wsgi"

<Location /hg/>
    AuthName "Mercurial Repositories"
    AuthType VisualSVN
    AuthzVisualSVNAccessFile "C:/Repositories/authz-windows"
    AuthnVisualSVNBasic on
    AuthnVisualSVNIntegrated off
    AuthnVisualSVNUPN Off

    SVNParentPath "C:/Repositories/"

    require valid-user
</Location>

创建 Mercurial 存储库:

hg init C:\Repositories\hgtest

您现在应该能够通过浏览器访问 /hg,并通过 VisualSVN 服务器工具管理存储库级别的授权。

于 2010-04-10T01:10:55.563 回答
2

假设您已安装并运行 Python 2.6,以下是我采取的步骤。

获取为Apache 2.2 Win32构建的“mod_cgi.so”并将其放置在“C:\Program Files\VisualSVN Server\bin”中。

将以下内容粘贴到“C:\Program Files\VisualSVN Server\conf\httpd-custom.conf”

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

创建 cgi-bin 目录,“C:\Program Files\VisualSVN Server\cgi-bin”。并将hgweb.cgi放入其中。确保它看起来类似于以下内容:

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

在 cgi-bin 目录中创建一个名为 hgweb.config 的文件。

[paths]
/ = c:/HgRepositories/*

将“C:\Program Files\Mercurial\templates”复制到“C:\Program Files\Mercurial\library\templates”。

创建“C:\HgRepositories”文件夹和“hg init c:\HgRepositories\test”。

重新启动 VisualSVN 服务器,打开浏览器,享受 Mercurial 存储库。

于 2010-04-09T21:00:32.303 回答
0

从 Mercurial 1.6 版本开始,hgwebdir.wsgi 脚本已与 hgweb.wsgi 脚本统一。在这些说明中,无论在何处引用 hgwebdir.wsgi,您都可以替换为 hgweb.wsgi 脚本。

https://www.mercurial-scm.org/wiki/modwsgi

于 2012-03-26T14:40:42.520 回答
-1

您可以在不同的身份验证和 https 模块后面运行 hgwebdir,只要您的网络服务器在 REMOTE_USER 变量被移交给 CGI 之前处理它们。

我不知道visualsvn,但你的ScriptAlias 看起来很像Apache。您是否需要.cgi的AddHandler行?

于 2010-03-11T23:24:33.070 回答