2009-12-28 54 views
1

我在嘗試將git存儲庫轉換爲mercurial時出錯。當我運行:將git轉換爲mercurial的問題

hg convert gitdir hgdir

我得到這個:

UnboundLocalError: local variable 'tz' referenced before assignment

背景:我剛安裝TortoiseHg並啓用了轉換擴展。

它看起來像nmercurial轉換是有問題的git存儲庫。我一直在使用git-gui(在windows下)管理git倉庫。

下面是完整的輸出:

scanning source... 
** unknown exception encountered, details follow 
** report bug details to http://mercurial.selenic.com/bts/ 
** or [email protected] 
** Mercurial Distributed SCM (version 1.4.1) 
** Extensions loaded: extdiff, convert 
Traceback (most recent call last): 
    File "hg", line 36, in <module> 
    File "mercurial\dispatch.pyo", line 16, in run 
    File "mercurial\dispatch.pyo", line 30, in dispatch 
    File "mercurial\dispatch.pyo", line 46, in _runcatch 
    File "mercurial\dispatch.pyo", line 449, in _dispatch 
    File "mercurial\dispatch.pyo", line 319, in runcommand 
    File "mercurial\dispatch.pyo", line 500, in _runcommand 
    File "mercurial\dispatch.pyo", line 454, in checkargs 
    File "mercurial\dispatch.pyo", line 448, in <lambda> 
    File "mercurial\util.pyo", line 386, in check 
    File "hgext\convert\__init__.pyo", line 229, in convert 
    File "hgext\convert\convcmd.pyo", line 398, in convert 
    File "hgext\convert\convcmd.pyo", line 312, in convert 
    File "hgext\convert\convcmd.pyo", line 109, in walktree 
    File "hgext\convert\convcmd.pyo", line 267, in cachecommit 
    File "hgext\convert\git.pyo", line 112, in getcommit 
UnboundLocalError: local variable 'tz' referenced before assignment 
+0

討論繼續在這裏(它確實屬於它):http://markmail.org/thread/yazxa5la524umbnf – 2009-12-28 20:38:29

+0

那裏沒有答案,至少還沒有答案。你知道如何解決這個問題嗎? – jdigital 2009-12-28 20:41:02

+0

我查看了有問題的代碼,但我不知道爲什麼'tz'變量最終被解除綁定。我希望你能像帕特里克建議的那樣發佈版本庫,這樣我們可以更好地幫助你。 – 2009-12-28 21:12:51

回答

1

在Patrick的幫助下(請參閱上述Martin Geisler引用的主題),我發現問題的原因:輸出一行文本的cmd.exe AutoRun註冊表項。

Mercurial轉換並不期待這個額外的行(當mercurial運行git命令來遍歷現有的存儲庫時輸出),並導致轉換程序窒息。刪除AutoRun條目(HKLM \ Software \ Microsoft \ Command Processor \ AutoRun)消除了該異常。

0

在我看來這樣的轉換擴展壞了,需要修理,那麼也許你應該就在該消息的開始聽取意見。

我對Mercurial完全沒有經驗,所以我只能提供一個簡單的解決方法:將git的內置快速導出和hg-fastimport結合在一起。祝你好運!

1

似乎這部分的convert擴展需要'作者'或'提交者'在日誌分析代碼的某個點設置。你可以嘗試追蹤當時正在轉換哪個提交,並向我們顯示此提交的「git log」輸出?

+0

我得出了同樣的結論,但我還沒有想出如何確定哪個提交導致了問題。它看起來像hg convert是掃描階段,而不是在轉換階段。 – jdigital 2009-12-28 21:50:25