在IIS7上托管Mercurial

时间:2010-05-19 18:42:57

标签: iis-7 mercurial windows-server-2008

请注意,这可能最适合在serverfault.com上,但由于它是关于托管程序员源代码存储库,我不完全确定。我先发布在这里,相信它会在必要时进行迁移。

我正在尝试在我自己的服务器上托管我的Mercurial存储库的克隆(我在其他地方有主要的repo),并且我正在尝试在IIS下设置Mercurial。

我按照指南here ,但收到错误消息

已解决:有关详细信息,请参阅此问题的底部。

错误消息是:

  

mercurial.error.RepoError:repository / path / to / repo /或/ config not found

这就是我的所作所为。

  1. 我安装了Mercurial 1.5.2
  2. 我创建了c:\ inetpub \ hg
  3. 我按照网页的说明下载了hg源代码,并将hgweb.cgi文件复制到c:\ inetpub \ hg(注意,网页上写着hgwebdir.cgi,但这个特定的文件确实如此不存在,hgweb.cgi但是,这可能是问题的根源吗?
  4. 我添加了一个hgweb.config,其中包含以下内容:

    [paths]
    repo1 = C:/hg/**
    [web]
    style = monoblue
    
  5. 我创建了c:\ hg,创建了一个子目录测试,并在其中创建了一个存储库

  6. 我从网站上安装了python 2.6.5,最新的2.6版本(网页提到我需要安装正确的版本,否则我会收到一条特定的错误消息,因为我没有收到类似于远程的错误消息提到的那个,我认为2.6.5不是问题)
  7. 我添加了一个新的虚拟主机hg.vkarlsen.no,指向c:\ inetpub \ hg
  8. 对于此主机,我在Handler Mappings部分下添加了一个脚本映射,根据网站上的说明将* .cgi映射到c:\python26\python.exe -u %s %s
  9. 然后我导航到http://hg.vkarlsen.no/hgweb.cgi进行测试,但收到错误消息。

    为了更容易测试,我退回到命令提示符,导航到c:\ inetpub \ hg,并执行以下命令(错误消息是下面文本的一部分):

    C:\inetpub\hg>c:\python26\python.exe -u hgweb.cgi
    Traceback (most recent call last):
      File "hgweb.cgi", line 16, in <module>
        application = hgweb(config)
      File "mercurial\hgweb\__init__.pyc", line 12, in hgweb
    
      File "mercurial\hgweb\hgweb_mod.pyc", line 30, in __init__
    
      File "mercurial\hg.pyc", line 82, in repository
    
      File "mercurial\localrepo.pyc", line 2221, in instance
    
      File "mercurial\localrepo.pyc", line 62, in __init__
    
    mercurial.error.RepoError: repository /path/to/repo/or/config not found
    

    为了解决这个问题,有谁知道我需要注意什么?


    编辑:好的,我认为我设法向解决方案迈进了一步,但我仍然感到难过。

    我意识到.cgi文件是一个python脚本文件,而不是编译的东西,所以我打开它进行编辑,这些行就在其中:

    # Path to repo or hgweb config to serve (see 'hg help hgweb')
    config = "/path/to/repo/or/config"
    

    所以这是我输入特定错误消息的来源。

    如果我将行更改为:

    config = "c:\\hg\\test"
    

    然后我可以通过Mercurial Web界面导航空存储库。

    但是,我想托管多个存储库,并且看到该行说我也可以链接到hgweb配置文件,我试过这个:

    config = "c:\\inetpub\\hg\\hgweb.config"
    

    但后来我收到以下错误消息:

    mercurial.error.Abort: c:\inetpub\hg\hgweb.config: not a Mercurial bundle file
    Exception ImportError: 'No module named shutil' in <bound method bundlerepository.__del__
    of <mercurial.bundlerepo.bundlerepository object at 0x0260A110>> ignored
    

    我尝试过的配置变量似乎没有用:

    config = "hgweb.config"
    config = "c:\\hg\\hgweb.config"
    
    • 我不记得的各种其他变体。

    所以,仍然难倒,指点任何人?

    希望这个问题能给别人一些信息,如果他们像我一样难过。

1 个答案:

答案 0 :(得分:7)

我最终不得不编辑hgweb.cgi文件:

from:  from mercurial.hgweb import hgweb, wsgicgi
       application = hgweb(config)

to:    from mercurial.hgweb import hgweb, hgwebdir, wsgicgi
       application = hgwebdir(config)

注意那里添加的hgwebdir部分。这是我的hgweb.config文件,位于与hgweb.cgi文件相同的目录中:

[collections]
C:/hg/ = C:/hg/

[web]
style = gitweb

这现在成功地为我的存储库服务。

相关问题