# HG changeset patch
# User Matt Harbison <
matt_h...@yahoo.com>
# Date 1658508311 14400
# Fri Jul 22 12:45:11 2022 -0400
# Branch stable
# Node ID 65359680e4dbfd5e320d0de744f7f21fdb82f4dc
# Parent 360fbf5381cc7b26fed008e417cea83231b03ee4
svn: restore decoding SVN revisions with UTF-8
18dd0bf3b68e and 5560bf292386 changed these to convert via `hglib.tounicode()`
for py3 support, but that is configurable with `HGENCODING`, and also uses
strict mode. It's better to use `replace`, so an unfixable unicode error
doesn't prevent a commit from being shown entirely.
diff --git a/tortoisehg/hgqt/csinfo.py b/tortoisehg/hgqt/csinfo.py
--- a/tortoisehg/hgqt/csinfo.py
+++ b/tortoisehg/hgqt/csinfo.py
@@ -240,8 +240,8 @@
if cvt.startswith(b'svn:'):
result = cvt.split(b'/', 1)[-1]
if cvt != result:
- return hglib.tounicode(result)
- return hglib.tounicode(cvt.split(b'@')[-1])
+ return pycompat.unicode(result, 'utf-8', 'replace')
+ return pycompat.unicode(cvt.split(b'@')[-1], 'utf-8', 'replace')
else:
return None
elif item == 'converted':
diff --git a/tortoisehg/hgqt/repomodel.py b/tortoisehg/hgqt/repomodel.py
--- a/tortoisehg/hgqt/repomodel.py
+++ b/tortoisehg/hgqt/repomodel.py
@@ -933,7 +933,7 @@
cvt = extra.get(b'convert_revision', b'')
if cvt:
if cvt.startswith(b'svn:'):
- return hglib.tounicode(cvt.split(b'@')[-1])
+ return pycompat.unicode(cvt.split(b'@')[-1], 'utf-8', 'replace')
if len(cvt) == 40:
try:
binascii.unhexlify(cvt)