在IIS7上托管Mercurial

ang*_*son 10 mercurial iis-7 windows-server-2008

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

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

我在这里按照指南,但我收到一条错误消息.

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

错误消息是:

mercurial.error.RepoError:找不到存储库/路径/到/ repo /或/ config

这就是我做的.

  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
    
    Run Code Online (Sandbox Code Playgroud)
  5. 我创建了c:\ hg,创建了一个子目录测试,并在其中创建了一个存储库

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

然后我通过导航到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
Run Code Online (Sandbox Code Playgroud)

有谁知道我需要注意什么才能解决这个问题?


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

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

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/path/to/repo/or/config"
Run Code Online (Sandbox Code Playgroud)

所以这是我的特定错误消息的来源.

如果我将行更改为:

config = "c:\\hg\\test"
Run Code Online (Sandbox Code Playgroud)

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

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

config = "c:\\inetpub\\hg\\hgweb.config"
Run Code Online (Sandbox Code Playgroud)

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

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
Run Code Online (Sandbox Code Playgroud)

我为config变量尝试的任何东西似乎都没有用:

config = "hgweb.config"
config = "c:\\hg\\hgweb.config"
Run Code Online (Sandbox Code Playgroud)
  • 各种其他变化我不记得了.

那么,仍然难倒,指点任何人?

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

ang*_*son 7

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

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

to:    from mercurial.hgweb import hgweb, hgwebdir, wsgicgi
       application = hgwebdir(config)
Run Code Online (Sandbox Code Playgroud)

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

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

[web]
style = gitweb
Run Code Online (Sandbox Code Playgroud)

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