UnicodeDecodeError in thg blame/annotate
Created originally on Bitbucket by jtn
The {{{thg blame}}} command on a file name containing a UTF-8 character fails with the following exception:
{{{ #!python ** Mercurial version (1.9.1). TortoiseHg version (2.1.3) ** Command: --nofork blame coś ** CWD: /tmp/testrepo ** Encoding: UTF-8 ** Extensions loaded: convert, fetch, graphlog, hgk, rebase, mq, purge, record, transplant ** Python version: 2.5.2 (r252:60911, Jan 24 2010, 17:44:40) [GCC 4.3.2] ** Qt-4.7.3 PyQt-4.8.4 Traceback (most recent call last): File "/usr/local/opt/thg-and-stuff/thg/tortoisehg/hgqt/manifestdialog.py", line 550, in init dlg.setSource(path, rev, line) File "/usr/local/opt/thg-and-stuff/thg/tortoisehg/hgqt/manifestdialog.py", line 76, in setSource self._manifest_widget.setSource(path, rev, line) File "/usr/local/opt/thg-and-stuff/thg/tortoisehg/hgqt/manifestdialog.py", line 473, in setSource self.setPath(path) File "/usr/local/opt/thg-and-stuff/thg/tortoisehg/hgqt/manifestdialog.py", line 495, in setPath self._treeview.setCurrentIndex(self._treemodel.indexFromPath(path)) File "/usr/local/opt/thg-and-stuff/thg/tortoisehg/hgqt/manifestmodel.py", line 171, in indexFromPath paths = path and unicode(path).split('/') or [] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 2: ordinal not in range(128)
}}}
Use the following bash script to reproduce the problem.
{{{ #! /bin/bash
set -eu trap 'echo "* exit code: $?"' exit unset LC_ALL export LANG=pl_PL.UTF-8 #export HGENCODING=utf8 # doesn't help hg init testrepo cd testrepo filename=$(printf "co\xc5\x9b") echo test > "$filename" hg ci -A -m1 thg --nofork blame "$filename" cd .. rm -r testrepo exit }}}
Attachments: test_thg_blame_utf8_filename