我正在搜索信息以使用推送模型为 Windows(7 或 XP)设置 Mercurial Server(xampp,如果知道它有用的话),就像在 this question 中一样。但我的团队由 5 到 8 个(无偿付能力的)人组成,每个人都在不同的地方工作,所以我不认为 bitbucket 解决方案或任何其他非私有(private) repo 。
我认为this post会成功的,但我之前没有使用过 cgi,
有人做过吗?我在哪里可以找到更详细的解释?提前致谢
[编辑]
我现在收到此错误:脚本 header 过早结束:hgwebdir.cgi
日志错误显示“没有名为 mercurial 的模块”
这是我的 hgwebdir.cgi 文件
#!c:/python24/python.exe
#
# An example CGI script to export multiple hgweb repos, edit as necessary
# adjust python path if not a system-wide install:
import sys
sys.path.insert(0, "c:/mercurial_library")
# enable importing on demand to reduce startup time
from mercurial import demandimport; demandimport.enable()
# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb
#cgitb.enable()
# If you'd like to serve pages with UTF-8 instead of your default
# locale charset, you can do so by uncommenting the following lines.
# Note that this will cause your .hgrc files to be interpreted in
# UTF-8 and all your repo files to be displayed using UTF-8.
#
#import os
#os.environ["HGENCODING"] = "UTF-8"
from mercurial.hgweb.hgwebdir_mod import hgwebdir
import mercurial.hgweb.wsgicgi as wsgicgi
application = hgwebdir('hgweb.config')
wsgicgi.launch(application)
最佳答案
我使用了 HgWebDir instructions :
这是我为 mercurial 站点编写的 httpd.conf 文件(略有编辑):
<VirtualHost *:88>
ServerName hg.example.com
DocumentRoot c:/apache_sites/hg
RewriteEngine on
RewriteRule ^/$ /public [R]
RewriteRule ^/public(.*) /public/hgwebdir.cgi$1 [L]
RewriteRule ^/private(.*) /private/hgwebdir.cgi$1 [L]
# mod_alias alternative (pretty url's)
<Directory c:/apache_sites/hg >
Order allow,deny
Allow from all
AllowOverride All
Options ExecCGI
AddHandler cgi-script .cgi
</Directory>
<Location /private/>
AuthType Digest
AuthName "hg.example.com"
AuthDigestProvider file
AuthUserFile c:/apache_sites/hg/hgusers
AuthGroupFile c:/apache_sites/hg/hggroup
AuthDigestDomain /private/
Require group owner
</Location>
<Location /public/>
AuthType Digest
AuthName "hg.example.com"
AuthDigestProvider file
AuthUserFile c:/apache_sites/hg/hgusers
AuthGroupFile c:/apache_sites/hg/hggroup
AuthDigestDomain /public/
<LimitExcept GET>
Require group developer
</LimitExcept>
</Location>
LogLevel debug
ErrorLog "c:/apache/logs/hg-error.log"
CustomLog "c:/apache/logs/hg-access.log" combined
LogLevel debug
</VirtualHost>
# vim:se ft=apache:
我还必须为 Auth Digest 等打开一些模块
我将 hgwebdir.cgi 放在公共(public)文件夹和私有(private)文件夹的根目录中,并将我的每个 hg 存储库放在适当文件夹下的 repos 子文件夹中。
Apache 身份验证负责我的授权。
然后我将 hgweb.config 文件放在相同的位置,如下所示:
[collections]
repos = repos
[web]
allow_archive = bz2 gz zip
style = gitweb
baseurl = /public
更新问题
mercurial 包需要在 PYTHON_PATH 上
This answer给出了更多细节。
关于windows - Apache/Windows 上的 Mercurial 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2229341/