在 IIS7 上托管 Mercurial

发布于 2024-09-02 01:05:47 字数 2943 浏览 6 评论 0原文

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

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

我按照这里的指南进行操作,但是我收到错误消息

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

错误信息是:

mercurial.error.RepoError:找不到存储库/path/to/repo/or/config

这就是我所做的。

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

    <前><代码>[路径] 回购1 = C:/hg/** [网络] 风格 = 单色
  5. 我创建了 c:\hg,创建了一个子目录 test,并在其中创建了一个存储库

  6. 我从网站安装了 python 2.6.5,最新的 2.6 版本(网页提到我需要安装正确的版本,否则我会收到特定的错误消息,因为我没有收到看起来像上面提到的错误消息,所以我认为 2.6.5 不是问题)
  7. 我添加了一个新的虚拟主机 hg.vkarlsen.no,将其指向 c:\inetpub\hg
  8. 对于该主机,我在“处理程序映射”部分下添加了一个脚本映射,按照网站上的说明将 *.cgi 映射到 c:\python26\python.exe -u %s %s

然后我通过导航到 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"
  • 我不记得还有其他各种变化。

所以,还是很困惑,有人指点一下吗?

希望这个问题能为其他像我一样困惑的人提供一些信息。

Note, this might perhaps be best suited on serverfault.com, but since it is about hosting a programmer source code repository, I am not entirely sure. I'm posting here first, trusting that it'll be migrated if necessary.

I'm attempting to host clones of my Mercurial repositories on my own server (I have the main repo somewhere else), and I'm attempting to set up Mercurial under IIS.

I followed the guide here, but I get an error message.

Solved: See bottom of this question for details.

The error message is:

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

Here's what I did.

  1. I installed Mercurial 1.5.2
  2. I created c:\inetpub\hg
  3. I downloaded the hg source as per the instructions of the webpage, and copied the hgweb.cgi file into c:\inetpub\hg (note, the webpage says hgwebdir.cgi, but this particular file does not exist, hgweb.cgi does, however, can this be the source of the problem?)
  4. I added a hgweb.config, with the following contents:

    [paths]
    repo1 = C:/hg/**
    [web]
    style = monoblue
    
  5. I created c:\hg, created a sub-directory test, and created a repository inside it

  6. I installed python 2.6.5, latest 2.6 version from the website (the webpage mentions I need to install the correct version or I'll get a specific error message, since I don't get an error message that looks remotely like the one mentioned, I assume that 2.6.5 is not the problem)
  7. I added a new virtual host hg.vkarlsen.no, pointing it to c:\inetpub\hg
  8. For this host, I added a script mapping under the Handler Mappings section, mapping *.cgi to c:\python26\python.exe -u %s %s as per the instructions on the website.

I then tested it by navigating to http://hg.vkarlsen.no/hgweb.cgi, but I get an error message.

To make it easier to test, I dropped to a command prompt, navigated to c:\inetpub\hg, and executed the following command (error message is part of the text below):

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

Does anyone know what I need to look at in order to fix this?


Edit: Ok, I think I managed to get one step closer to the solution, but I'm still stumped.

I realized the .cgi file is a python script file, and not something compile, so I opened it for editing, and these lines was sitting in it:

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

So this was my source for the specific error message.

If I change the line to this:

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

Then I can navigate the empty repository through the Mercurial web interface.

However, I want to host multiple repositories, and seeing as the line says that I can also link to a hgweb config file, I tried this:

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

But then I get the following error message:

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

Nothing I've tried for the config variable seems to work:

config = "hgweb.config"
config = "c:\\hg\\hgweb.config"
  • various other variations I don't remember.

So, still stumped, pointers anyone?

Hopefully this question will give others some information if they're stumped as I was.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梨涡 2024-09-09 01:05:47

我最终不得不编辑 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

现在它可以成功地为我的存储库提供服务。

I ended up having to edit the hgweb.cgi file:

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

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

Note the added hgwebdir parts there. Here's my hgweb.config file, located in the same directory as hgweb.cgi file:

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

[web]
style = gitweb

This now serves my repositories successfully.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文