Apache/Windows上的Mercurial服务器
我正在搜索信息,为Windows(7或XP)安装Mercurial服务器,使用Apache(如果知道它有用的话,可以使用xampp)和推送模式,就像在中一样,但我的团队由5到8名(未出事)人员组成,他们每个人都在不同的地方工作,所以我不认为bitbucket解决方案或任何其他非私有回购存在 我想我会成功的,但我以前从未体验过cgi 以前有人这样做过吗?我在哪里可以找到更详细的解释?提前谢谢 [编辑] 我现在遇到这个错误:脚本头过早结束:hgwebdir.cgi 日志错误显示“没有名为mercurial的模块” 这是我的hgwebdir.cgi文件Apache/Windows上的Mercurial服务器,windows,apache,mercurial,Windows,Apache,Mercurial,我正在搜索信息,为Windows(7或XP)安装Mercurial服务器,使用Apache(如果知道它有用的话,可以使用xampp)和推送模式,就像在中一样,但我的团队由5到8名(未出事)人员组成,他们每个人都在不同的地方工作,所以我不认为bitbucket解决方案或任何其他非私有回购存在 我想我会成功的,但我以前从未体验过cgi 以前有人这样做过吗?我在哪里可以找到更详细的解释?提前谢谢 [编辑] 我现在遇到这个错误:脚本头过早结束:hgwebdir.cgi 日志错误显示“没有名为mercur
#!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)
我使用了:
这是我为mercurial站点(略经编辑)编写的httpd.conf文章:
更新的问题
mercurial包需要位于PYTHON_路径上
提供更多详细信息。John Weldons的回答是正确的,我只想提供一点关于您可能也感兴趣的各种可能性的详细信息 hgwebdir只是一个应用程序,所以您可以像在apache2中使用的任何其他wsgi应用程序一样运行它。mod_wsgi的性能也将优于cgi,因为加载python解释器的开销是一次性完成的,而不是针对每个请求 此外,作为一个wsgi应用程序,意味着您也可以将其封装在一个更大的网站中,等等 例如,假设您正在使用(另一个wsgi应用程序),并且希望在trac和hgwebdir之间共享授权方案,这可以通过将它们都放在授权中间件后面来实现,例如 最后,由于使用较小的片段构建web应用程序,我编写了这个代码片段,通过粘贴启动hgwebdir
"""
Wsgi wrapper of hgweb that is paste compatible
"""
import os
from mercurial import demandimport
demandimport.enable()
from mercurial.hgweb.hgwebdir_mod import hgwebdir
CONFIG_FILE_KEY = "hgwebdir.config"
def hgweb_paste(global_config, **local_conf):
"""
looking for a config file setting in global or local
"""
cfg = global_config
cfg.update(local_conf)
config_file = cfg.get(CONFIG_FILE_KEY)
if config_file and os.path.exists(config_file):
return hgwebdir(config_file)
else:
raise KeyError, "%s not set or %s does not exist" % (CONFIG_FILE_KEY,config_file)
和相应的配置文件部分加载它
[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 6543
[app:main]
use = egg:hg.paste#hgweb
hgwebdir.config = %(here)s/hg.config
我发现这篇博文特别有用:
这很简单,切中要害,让我在不到15分钟的时间内起床工作。我打破了小时记录,却没有得到任何答案。。。现在8小时!关于这个主题的另一个有用的演练是:为了进一步参考,我也有一个错误“脚本头过早结束:hgweb.cgi”(新版本的入口点,而不是hgwebdir.cgi)。原来是权限问题。hgweb.cgi文件的包含目录及其内容需要为755。这篇文章最终帮了我的忙:我的dir应该是:d:/hg_repos/public/hgwebdir.cgi d:/hg_repos/public/hgweb.config d:/hg_repos/public/repos/和private相同?很抱歉,我遇到了这个错误:脚本头过早结束:hgwebdir.cgi。。。我还能查什么?我下载了Python2.4.4。也许是这个?我有点困惑,洛莉约翰非常感谢。。。我现在让它运行。。。但我看不到我的回购协议。。。但我认为这是设置hgweb.config的问题,我已经接受了你的答案,txs。。。你知道在哪里可以找到更多关于hgweb.config结构的信息吗?我找到了。。。hgweb.config上的[路径]部分!名称=路径syntaxNice。。。干得好。玩得开心:)我会去看看。。。我需要更多的专业知识,不过我对这个太不熟悉了。
"""
Wsgi wrapper of hgweb that is paste compatible
"""
import os
from mercurial import demandimport
demandimport.enable()
from mercurial.hgweb.hgwebdir_mod import hgwebdir
CONFIG_FILE_KEY = "hgwebdir.config"
def hgweb_paste(global_config, **local_conf):
"""
looking for a config file setting in global or local
"""
cfg = global_config
cfg.update(local_conf)
config_file = cfg.get(CONFIG_FILE_KEY)
if config_file and os.path.exists(config_file):
return hgwebdir(config_file)
else:
raise KeyError, "%s not set or %s does not exist" % (CONFIG_FILE_KEY,config_file)
[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 6543
[app:main]
use = egg:hg.paste#hgweb
hgwebdir.config = %(here)s/hg.config