2010-05-19 78 views
10

請注意,這可能最適合於serverfault.com,但由於它是託管程序員源代碼庫,所以我不完全確定。我先在這裏發帖,相信如果有必要,它會被遷移。在IIS7上託管Mercurial

我試圖在我自己的服務器上託管我的Mercurial存儲庫的克隆(我在其他地方有主要的倉庫),我試圖在IIS下設置Mercurial。

我按照指南here ,但我收到一條錯誤消息

已解決:有關詳細信息,請參閱此問題的底部。

的錯誤信息是:

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

這裏就是我所做的。

  1. 我安裝的Mercurial 1.5.2
  2. 我創建的C:\的Inetpub \汞柱
  3. 我下載了汞源按照網頁的指示,並複製hgweb.cgi文件到C:\的Inetpub \汞柱(注意到,該網頁說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根據網站上的說明。

然後我通過導航到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" 

然後,我可以通過水銀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

你可以自己回答並接受你的答案,所以這個問題不會顯示爲沒有答案。 – tonfa 2010-09-01 12:00:40

+0

感謝您的提醒。 – 2010-09-01 21:16:27

回答

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 

這現任我的倉庫成功。