我正在寻找信息来设置适用于 Windows(7 或 XP)的 Mercurial 服务器,并使用 Apache(xampp,如果了解它有用的话)和推送模型,就像 这个问题,但我的团队由 5 到 8 个(无偿付能力的)人组成,每个人都在不同的地方工作,所以我不认为 bitbucket 解决方案或任何其他解决方案那里有非私人回购。
我认为 这篇文章 可以解决问题,但我以前没有经历过任何与 cgi 相关的事情,
以前有人这样做过吗?我在哪里可以找到更详细的解释?提前致谢
[编辑]
我现在收到此错误:脚本标头过早结束: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)
I'm searching for info to setup a Mercurial Server for Windows (7 or XP) with an Apache (xampp if it is useful to know it) with the Push Model, just like in this question but my team is composed of 5 to 8 (unsolvent) guys who are each one working in separated places, so I don't think the bitbucket solution or anyother non-private repo out there.
I think this post would do the trick, but i haven't experienced anything with cgi before,
Has anybody done this before? where can I find a more detailed explanation? thanks in advance
[EDIT]
I'm now getting this error: Premature end of script headers: hgwebdir.cgi
The log error says "no module named mercurial"
this is my hgwebdir.cgi file
#!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)
发布评论
评论(3)
我使用了 HgWebDir 说明:
这是我的 Mercurial 站点的 httpd.conf 片段(稍作编辑):
我还必须打开一些用于 Auth Digest 等的模块。
我将 hgwebdir.cgi 放在公共和私有文件夹的根目录中,然后将每个 hg 存储库放在 repos 子文件夹中适当的文件夹。
Apache 身份验证负责我的授权。
然后我只是将 hgweb.config 文件放在相同的位置,如下所示:
更新的问题
Mercurial 包需要位于 PYTHON_PATH
此答案提供了更多详细信息。
I used the HgWebDir instructions:
Here is my httpd.conf piece for the mercurial sites (slightly edited):
I also had to turn on a few modules for Auth Digest, etc.
I put the hgwebdir.cgi in the root of the public and the private folders, and just put each of my hg repos in the repos subfolder under the appropriate folders.
Apache authentication took care of my authorization.
Then I just put a hgweb.config file in the same locations like this:
Updated Question
The mercurial packages need to be on the PYTHON_PATH
This answer gives more detail.
John Weldons 的答案是正确的,我只是想提供一些您可能感兴趣的各种可能性的细节。
hgwebdir 只是一个 wsgi 应用程序,因此您可以像任何其他 wsgi 应用程序一样使用 mod_wsgi< /a> 在 apache2. mod_wsgi 的性能也比 cgi 更好,因为加载 python 解释器的开销是一次性完成的,而不是针对每个请求。
另外,由于是 wsgi 应用程序,意味着您还可以将其包装在 中间件 中,或 将其挂在更大网站的另一个网址上等等...
例如,假设您正在使用 trac(另一个 wsgi 应用程序)并且您想在 trac 和 hgwebdir 之间共享授权方案,这可以通过将它们放在一起来完成两者都位于授权中间件之后,例如 repoze.who 。
最后,由于 python Paste 可以用较小的部分构建 Web 应用程序,因此我编写了此代码片段以通过粘贴启动 hgwebdir。
以及相应的配置文件部分来加载它......
John Weldons answer is correct, I just wanted to provide a little detail on the wide array of possibilities you may also be interested in.
hgwebdir is just a wsgi application, so you can run it like any other wsgi application using mod_wsgi in apache2. mod_wsgi will also perform better than cgi because the overhead of loading the python interpreter is done once rather than for each request.
Also by virtue of being a wsgi application means you can also wrap it up in middleware, or hang it off another url of a bigger website etc...
For example, say you are using trac(another wsgi app) and you want to share the authorization scheme between trac and hgwebdir, this can be accomplished by putting them both behind authorization middleware like repoze.who for example.
Finally, since python paste makes building web apps out of smaller pieces, I wrote this code snippet to start hgwebdir via paste.
And the corresponding config file part to load it...
我发现这篇博客文章特别有用: http ://blog.riverside-software.fr/2011/02/quick-and-easy-setup-of-mercurial.html。
这很简单,一语中的,不到 15 分钟就让我开始工作。
I found this blog post particularly helpful: http://blog.riverside-software.fr/2011/02/quick-and-easy-setup-of-mercurial.html.
It's simple, to the point, and got me up and working in less than 15 minutes.