将git转换为mercurial的问题

时间:2009-12-28 19:32:52

标签: git mercurial

我在尝试将git存储库转换为mercurial时遇到错误。我跑的时候:

  

hg convert gitdir hgdir

我明白了:

  

UnboundLocalError:在赋值之前引用的局部变量'tz'

背景:我刚安装了TortoiseHg并启用了转换扩展程序。

看起来nmercurial convert存在git存储库问题。我一直用git-gui管理git存储库(在windows下)。

这是完整输出:

scanning source...
** unknown exception encountered, details follow
** report bug details to http://mercurial.selenic.com/bts/
** or mercurial@selenic.com
** 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

3 个答案:

答案 0 :(得分:1)

似乎转换扩展的这一部分要求在日志解析代码的某个点设置'author'或'committer'。您是否可以尝试跟踪当时正在转换的提交并向我们显示此提交的“git log”输出?

答案 1 :(得分:1)

在Patrick的帮助下(参见上面Martin Geisler引用的主题),我发现了问题的原因:输出一行文本的cmd.exe AutoRun注册表项。

Mercurial convert并不期望这个额外的行(当mercurial运行git命令来遍历现有的存储库时输出)并且它导致转换程序窒息。删除AutoRun条目(HKLM \ Software \ Microsoft \ Command Processor \ AutoRun)消除了异常。

答案 2 :(得分:0)

在我看来,转换扩展已经破解并且需要修复,所以也许你应该在消息开头就注意这个建议。

我对Mercurial没有任何经验,所以我能提供的只是一个简单的解决方法:结合git的内置快速导出和hg-fastimport。祝你好运!