A partial archive of https://discourse-mediawiki.wmflabs.org as of Saturday May 21, 2022.

My git-review is broken

RazeSoldier

%E6%93%B7%E5%8F%96

As you see, this should be a coding problem. But I will not fix it, I know nothing about python.

Can anyone give some advice?

LucasWerkmeisterWMDE

Looks like some encoding problem – what’s your locale? (You might be able to run locale to view the details, but I’m not sure, since this looks like some kind of Windows system.)

RazeSoldier

My PC system is win 7, locale:

LANG=zh_HK.UTF-8
LC_CTYPE="zh_HK.UTF-8"
LC_NUMERIC="zh_HK.UTF-8"
LC_TIME="zh_HK.UTF-8"
LC_COLLATE="zh_HK.UTF-8"
LC_MONETARY="zh_HK.UTF-8"
LC_MESSAGES="zh_HK.UTF-8"
LC_ALL=

Chicocvenancio

@RazeSoldier this is a weird character to have. Either it is part of a multibyte character that is being misinterpreted as a full character or it is the Windows-1252 codec “smart quote” character.

If the latter, remove it from where git review is seeing it (probably your git config). If the former, we need to understand why your locale says UTF-8 but git-review is using gbk.

RazeSoldier

This is git config of my working directory while I was work:

[core]
	repositoryformatversion = 0
	filemode = false
	bare = false
	logallrefupdates = true
	symlinks = false
	ignorecase = true
	autocrlf = input
[remote "gerrit"]
	url = ssh://razesoldier@gerrit.wikimedia.org:29418/mediawiki/core.git
	fetch = +refs/heads/*:refs/remotes/gerrit/*
[branch "master"]
	remote = gerrit
	merge = refs/heads/master
[remote "github"]
	url = git@github.com:wikimedia/mediawiki.git
	fetch = +refs/heads/*:refs/remotes/github/*
[commit]
	gpgsign = false
RazeSoldier

I used MINGW32 to execute git-review. Maybe I use CMD to execute it, there is no such problem?

Chicocvenancio

I’m pretty sure that “shouldn’t” make a difference, but if it works…
I still can’t see where gitreview is getting that character from. Are there any source of chinese characters for it to see? Or any source of the weird “smart quote” Windows-1252 character?

Chicocvenancio

You might be able to get away with using chcp 65001 on CMD to change the console code page and that might solve your issues, if that is the case we should file a bug about this. Bytes to the console should be explicitly encoded.

RazeSoldier

It is good again in another directory. I don’t know how this problem was caused. After that I will keep observing its behavior and if there is a similar error, I will come back here.

Tgr

From the stack trace it seems git-review is trying to print something, probably the list of pending changes, so one of your commits might have a non-ASCII character in the subject line, and git core and the git-review Python script are using different encodings or something like that. T49633 is relevant but also very old.

jehovahsays

I had the same brain storm. If the original python commands your using are not for that python version you must verify which versions are compatible. git-review works good in bash with admin. Also be aware these fixes will break other services that your networking communications needed. downgrading and/or upgrading have the responsibilities of causing loss of existing services coming from a networking server because the attempted to gain missing services. In simple terms. The server you have runs a python downgrade for upgrade commands but the other commands need the downgrade python service and not the upgraded python service. and your using windows command shell window and not a bash shell window.

RazeSoldier

Now I know why this error occurred. Because the submit summary contain Chinese characters. This means that I must go to gerrit UI page to submit a patch containing the Chinese summary.

Chicocvenancio

Gerrit should be able to deal with Chinese characters.
Did you try the chp 65001 on cmd?
You might also have some luck changing the cmd font to a truetype font.