0

当我尝试在 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

4

1 回答 1

3

Try to install Python 2.7.* and launch git review with it. I also had problems with running git-review on Python 3.* although authors claim that it is supported.


By investigating your problem in detail I noticed that the problem is with \u2026 character (that is horizontal ellipsis - …). Python is known to have problems with decoding it.

As a temporary fix, please reword your commit messages not to contain problematic characters (replace … with three dots).

You may also use command git review -y to skip displaying the confirmation (thus the error message too).


I have created a bug report for git-review.

于 2014-09-05T20:16:45.927 回答