在Windows XP上使用Apache运行Mercurial

时间:2010-07-29 15:09:21

标签: apache mercurial windows-xp hgweb

我一直在努力让Mercurial在Windows XP上使用Apache。

我已阅读并尝试了以下SO主题中的建议:123& 4

到目前为止,我所能做的只是一个空白页面,当我查看源代码时,我可以看到:

<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->
</font> </font> </font> </script> </object> </blockquote> </pre>
</table> </table> </table> </table> </table> </font> </font> </font>

我正在与之合作:

  • Apache 2.2 - C:\Program Files\Apache Software Foundation\Apache2.2\
  • Python 2.4(由Mercurial网站推荐) - C:\Program Files\Python\2.4\
  • Mercurial 1.6 - C:\Program Files\Mercurial\
  • mod_python 3.3.1
  • Apache DocumentRoot:C:\htdocs\hg\通过http://hg.paperclip.dev访问(添加到主机文件)
  • Hg Repository(在网络驱动器上):H:\repo\

我觉得复杂的部分原因是我在网络驱动器上有我的回购。我可以通过网络驱动器号H或\\SERVER\WebDev\repo\

访问

Mercurial安装目录中的mercurial.ini如下:

[ui]
editor = Notepad
username = paperclip <p@paperclip.com>

由apache(hgweb.config)提供的Hg DocumentRoot中的C:\htdocs\hg\

[collections]
//SERVER/WebDev/repo = //SERVER/WebDev/repo**

由apache(hgweb.cgi)服务的Hg DocumentRoot中的C:\htdocs\hg\

#!C:/Program Files/Python/2.4/python.exe

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "C:/htdocs/hg/hgweb.config"

# Uncomment and adjust if Mercurial is not installed system-wide:
import sys; sys.path.insert(0, "C:/Program Files/Mercurial/lib")

# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb
from flup.server.fcgi import WSGIServer
application = hgweb(config)
WSGIServer(application).run()

我的Apache的VirtualHosts文件

<VirtualHost *:80>
  ServerName hg.paperclip.dev
  #ServerAlias paperclip.com *.paperclip.com
  ServerAdmin p@paperclip.com
  CustomLog "logs/hg-access.log" combined
  ErrorLog "logs/hg-error.log"

  RewriteEngine on
  RewriteRule (.*) C:/htdocs/hg/hgweb.cgi/$1

  # Or we can use mod_alias for starting CGI script and making URLs "nice":
  # ScriptAliasMatch ^(.*) C:/htdocs/hg/hgweb.cgi/$1

  <Directory "C:/htdocs/hg/">

    Order allow,deny
        Allow from all
        AllowOverride All
        Options ExecCGI FollowSymLinks +Indexes
        AddHandler cgi-script .cgi

  </Directory>
</VirtualHost>

考虑到上述配置,我欢迎一些建议来实现这一目标。我可以尝试任何东西,因为我已经达到了死胡同。

非常感谢提前。

-P

2 个答案:

答案 0 :(得分:0)

这是昨天发布的:
Setup Mercurial Server in Windows Machine - Tutorials are outdated

这家伙设法让HG + Apache在Windows 7上工作。
我知道,你使用的是XP而不是Win 7,但也许这个链接可以帮助你。

答案 1 :(得分:0)

Hg 2.0.1

Apache 2.2.21

Python 2.6!

#!c:/python26/python.exe
#
# An example hgweb CGI script, edit as necessary
# See also http://mercurial.selenic.com/wiki/PublishingRepositories

# Path to repo or hgweb config to serve (see 'hg help hgweb')
#config = "/path/to/repo/or/config"
config = "c:/batch/merc-web.conf"

# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
#import sys; sys.path.insert(0, "/path/to/python/lib")
#import sys; sys.path.insert(0, "c:/mercurial")

# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)

忘记mod_python,:81是我的机器上的IIS,而apache是​​80和91,所以http://ap.xxx.tzo.net/cgi-bin/hgweb.cgi工作

<VirtualHost *:80>
ServerName ap.xxx.tzo.net
ServerAlias ap.xxx.tzo.net

ProxyPreserveHost On
ProxyPass / http://localhost:91/
ProxyPassReverse / http://localhost:91/
<Proxy http://localhost:91/>
#  Order Allow,Deny
#  Allow from all
   Order Deny,Allow
   Allow from 127.0.0.1
</Proxy>
</VirtualHost>

也是envvar PYTHONPATH C:\ Python26

我意识到你使用不同版本的HG等,但我希望这会有所帮助。 我想我花了2天时间;)

尝试使用本地仓库,您的mercurial.ini是N / A.我的merc-web.conf看起来像:

[web]
style = coal

[paths]
/hgAppThree = C:\!mark\_dev\hgAppThree

适用于

http://ap.xxx.tzo.net/cgi-bin/hgweb.cgi/hgAppThree

祝你好运!