【问题标题】:pygit2 raises KeyError: 'the requested type does not match the type in the ODB'pygit2 引发 KeyError:\'请求的类型与 ODB 中的类型不匹配\'
【发布时间】:2022-10-06 04:11:33
【问题描述】:

我正在将一些 python2 代码移植到 python3 - 单一代码库。我在 cpython 2.7 上使用 pygit2 0.28.2,在 cpython3.10 上使用 pygit2 1.9.2,至少现在是这样。

我收到一个错误 (-3) 来自:

err = C.git_remote_push(self._remote, refspecs, opts)

...并且 payload.check_error(err) 将其映射到:

KeyError: \'the requested type does not match the type in the ODB\'

该错误仅出现在 cpython3.10 上,而不是 cpython2.7 上。

恐怕我不知道该怎么做。我用谷歌搜索了大约 90 分钟,并没有找到太多。

这是完整的追溯:

Traceback (most recent call last):
    File \"/app/shared/common/git/handlers.py\", line 488, in Push
        remote.push(temp3, callbacks=self.callbacks)
    File \"/usr/local/lib/python3.10/site-packages/pygit2/remote.py\", line 257, in push
        payload.check_error(err)
    File \"/usr/local/lib/python3.10/site-packages/pygit2/callbacks.py\", line 93, in check_error
        check_error(error_code)
    File \"/usr/local/lib/python3.10/site-packages/pygit2/errors.py\", line 56, in check_error
        raise KeyError(message)\'
KeyError: \'the requested type does not match the type in the ODB\'

任何人都可以在正确的方向上轻推我吗?它抱怨什么类型的?对于 pygit2,传递的数据似乎很不透明。

pygit2 0.28.2 是否有可能总是“强制”,而 pygit2 1.9.2 只会按请求强制?我们在 Python 3 中关闭了 libgit2 的“严格模式”。

谢谢!

    标签: python libgit2 pygit2


    【解决方案1】:

    事实证明,如果我们从 0.28.2 开始,pygit2 0.28.2 可以工作。如果我们稍后从 1.5.0 开始,然后手动切换回 0.28.2,那么 git repo 已经损坏,导致 0.28.2 也出现错误。

    可能(有些)以后的版本也很高兴,但那是另一回事了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-19
      • 1970-01-01
      • 2010-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多