【问题标题】:Error while submitting code to gerrit using git-review on windows在 Windows 上使用 git-review 向 gerrit 提交代码时出错
【发布时间】:2014-10-30 02:45:05
【问题描述】:

当我尝试在 Windows 上使用 gitbash 将代码提交到 gerrit 时出现错误。 错误如下:

$ git review
You are about to submit multiple commits. This is expected if you are
submitting a commit that is dependent on one or more in-review
commits. Otherwise you should consider squashing your changes into one
commit before submitting.
Traceback (most recent call last):
  File "c:\Python33\Scripts\git-review-script.py", line 9, in <module>
    load_entry_point('git-review==1.24', 'console_scripts', 'git-review')()
  File "C:\Python33\lib\site-packages\git_review\cmd.py", line 1214, in main
    assert_one_change(remote, branch, yes, have_hook)
  File "C:\Python33\lib\site-packages\git_review\cmd.py", line 718, in assert_on
e_change
    "Do you really want to submit the above commits?" % output)
  File "C:\Python33\lib\encodings\cp850.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2026' in position
8042: character maps to <undefined>

进程中止发布错误消息。 git-review 版本如下:

$ git review --version
git-review-script.py version 1.24

我的 windows 机器上的 git 版本也是:

git version 1.9.4.msysgit.1

我非常需要帮助或任何有关如何使其正常工作的线索。

我的 cmd.exe 上显示的字符编码是 850

【问题讨论】:

  • 其中一条提交消息是否包含水平椭圆 (U+2026) 字符?你能把它换成“...”吗?

标签: git gerrit git-review


【解决方案1】:

尝试安装 Python 2.7.* 并使用它启动 git review。我在 Python 3.* 上运行 git-review 时也遇到了问题,尽管作者声称它是受支持的。


通过详细调查您的问题,我注意到问题出在\u2026 字符上(即horizontal ellipsis - ...)。 Python is known to have problems 正在解码。

作为临时修复,请reword您的提交消息不要包含有问题的字符(用三个点替换......)。

您也可以使用命令git review -y 跳过显示确认(因此也显示错误消息)。


我为 git-review 创建了一个 bug report。

【讨论】:

  • 谢谢,我也尝试过使用 Python 2.7,但它没有帮助。使用 python 2.7 而不是 3.3 显示相同的错误。我通过卸载最新版本然后通过安装 get-pip 重新安装了 git review。 py。但这也无济于事。对此有任何建议。但只有当我试图通过 git review -R 命令将我的代码推送到 gerrit 进行代码审查时,它才会失败并显示上述消息。
  • 嗨!非常感谢您的回复。这确实很有用。虽然我在提交消息中找不到任何 (...) 字符,但不知何故我认为我的提交消息很长,可能是导致引入省略号。尽管如此,我所做的是我改写了我的提交消息以及使用 git review -y。git review -y 命令有什么作用?我的意思是 -y 选项?
  • -y 选项告诉 git-review 在一次向 gerrit 发送多个提交时不要要求您确认。因为问题在于显示此确认,所以跳过它可以解决您的问题。运行git review -h以了解更多信息。
  • 非常感谢。这确实很有帮助。
  • 是的。替换中文字符,git review在win7上工作。
猜你喜欢
  • 2012-01-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-07-02
  • 2017-06-18
  • 1970-01-01
  • 1970-01-01
  • 2011-06-24
相关资源
最近更新 更多