Import Bzr:Can';由于UTF-8错误,无法导入Mercurial(Hg)存储库

Import Bzr:Can';由于UTF-8错误,无法导入Mercurial(Hg)存储库,import,bazaar,Import,Bazaar,我有一个Mercurial存储库,它成功地导出为“快速导入”格式。但是,当我尝试导入时,它失败并出现“utf8”错误: ... 16:02:09 800/2100 commits processed at 199/minute (800) 16:03:52 900/2100 commits processed at 157/minute (900) ABORT: exception occurred processing commit :901 bzr: ERROR: exceptions.Un

我有一个Mercurial存储库,它成功地导出为“快速导入”格式。但是,当我尝试导入时,它失败并出现“utf8”错误:

...
16:02:09 800/2100 commits processed at 199/minute (800)
16:03:52 900/2100 commits processed at 157/minute (900)
ABORT: exception occurred processing commit :901
bzr: ERROR: exceptions.UnicodeDecodeError: 'utf8' codec can't decode byte 0xb9 in position 14: unexpected code byte

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/bzrlib/commands.py", line 946, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/bzrlib/commands.py", line 1150, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/pymodules/python2.6/bzrlib/commands.py", line 699, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/pymodules/python2.6/bzrlib/commands.py", line 721, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/bzrlib/cleanup.py", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/pymodules/python2.6/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/bzrlib/plugins/fastimport/cmds.py", line 314, in run
    user_map=user_map)
  File "/usr/lib/pymodules/python2.6/bzrlib/plugins/fastimport/cmds.py", line 40, in _run
    return proc.process(p.iter_commands)
  File "/usr/lib/pymodules/python2.6/bzrlib/plugins/fastimport/processors/generic_processor.py", line 311, in process
    super(GenericProcessor, self)._process(command_iter)
  File "/usr/lib/pymodules/python2.6/fastimport/processor.py", line 76, in _process
    handler(self, cmd)
  File "/usr/lib/pymodules/python2.6/bzrlib/plugins/fastimport/processors/generic_processor.py", line 536, in commit_handler
    handler.process()
  File "/usr/lib/pymodules/python2.6/fastimport/processor.py", line 158, in process
    handler(self, fc)
  File "/usr/lib/pymodules/python2.6/bzrlib/plugins/fastimport/bzr_commit_handler.py", line 890, in modify_handler
    self._modify_item(filecmd.path.decode('utf8'), kind,
  File "/usr/lib/python2.6/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb9 in position 14: unexpected code byte
我在Ubuntu上运行这个。bzr版本“2.4.0-1~bazaar1~lucid1”和bzr fastimport版本“0.11.0-1~lucid1”


成功转换此存储库有什么想法吗?

发生此错误是因为输入流中存在无效的utf8数据;Mercurial通常只存储utf8数据,但较旧的提交可能仍然包含utf8无效数据(请参阅)

请针对bzr fastimport()提交有关此问题的错误。它应该更优雅地处理这种情况;大概它应该警告您存在utf8无效数据,然后替换utf8无效字符


作为权宜之计,您可以将/usr/lib/pymodules/python2.6/bzrlib/plugins/fasimport/bzr_commit_handler.py行890上的path.decode('utf-8')更改为path.decode('utf-8','replace')。

发生此错误的原因是输入流中存在无效的utf8数据;Mercurial通常只存储utf8数据,但较旧的提交可能仍然包含utf8无效数据(请参阅)

请针对bzr fastimport()提交有关此问题的错误。它应该更优雅地处理这种情况;大概它应该警告您存在utf8无效数据,然后替换utf8无效字符


作为权宜之计,您可以将/usr/lib/pymodules/python2.6/bzrlib/plugins/fasimport/bzr_commit_handler.py行890上的path.decode('utf-8')更改为path.decode('utf-8','replace')。

您的存储库中是否有不能以unicode表示的特殊字符的文件名?不确定。。。不过,我确实将存储库导入到Git中,这是成功的。您的存储库是否有不能以unicode表示的带有特殊字符的文件名?不确定。。。不过,我确实将存储库导入到Git中,这是成功的。感谢您的修复,我还必须在第895行执行相同的操作,但它随后能够成功导入!运行“pack”后,存储库比我用Git所能完成的要小得多,甚至比原来的Mercurial存储库还要小。多亏了这个修复,我也不得不在第895行上做同样的操作,但它随后成功导入了!运行“pack”后,存储库比我用Git所能完成的要小得多,甚至比原来的Mercurial存储库还要小。