2009-12-28 76 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