代码之家  ›  专栏  ›  技术社区  ›  jdigital

将Git转换为Mercurial时出现问题

  •  1
  • jdigital  · 技术社区  · 15 年前

    尝试将Git存储库转换为Mercurial时出错。当我跑步时:

    Hg转换GitDir HgDir

    我明白这一点:

    UnboundLocalError:在赋值之前引用了局部变量“TZ”

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

    看起来nmurcial convert在Git存储库中有问题。我一直在用GitGUI(在Windows下)管理Git存储库。

    以下是完整的输出:

    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 回复  |  直到 8 年前
        1
  •  1
  •   Giorgos Keramidas    15 年前

    转换扩展的这一部分似乎希望在日志分析代码的某个点设置“author”或“committer”。您是否可以尝试跟踪当时正在转换的提交,并显示此提交的“Git日志”输出?

        2
  •  1
  •   jdigital    15 年前

    在Patrick的帮助下(参见上面MartinGeisler引用的线程),我发现了问题的原因:一个输出一行文本的cmd.exe自动运行注册表项。

    mercurial convert不希望有这一额外的行(当mercurial运行git命令来遍历现有存储库时输出),它导致convert程序阻塞。删除自动运行项(hklm\software\microsoft\command processor\autorun)消除了异常。

        3
  •  0
  •   Vadim Kotov First Zero    8 年前

    在我看来,convert扩展被破坏了,需要修复,所以也许您应该在消息的开头注意这些建议。

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