Mercurial > public > mercurial-scm > hg-stable
diff mercurial/obsutil.py @ 38707:6b5ca1d0aa1e
obsolete: store user name and note in UTF-8 (issue5754) (BC)
Before, user names were stored in local encoding and transferred across
repositories, which made it impossible to restore non-ASCII user names on
different platforms. This patch fixes new markers to be encoded in UTF-8
and decoded back to local encoding when displaying. Existing markers are
unfixable so they may result in mojibake.
I don't like the API that requires metadata dict to be UTF-8 encoded, which
is a source of bugs, but there's no abstraction layer to process the encoding
thingy efficiently. So we apply the same rule as extras dict to obsstore
metadata.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 15 Jul 2018 18:24:57 +0900 |
parents | 83d965803325 |
children | 52e6171ec822 |
line wrap: on
line diff
--- a/mercurial/obsutil.py Sun Jul 15 18:22:40 2018 +0900 +++ b/mercurial/obsutil.py Sun Jul 15 18:24:57 2018 +0900 @@ -12,6 +12,7 @@ from .i18n import _ from . import ( diffutil, + encoding, node as nodemod, phases, util, @@ -822,7 +823,8 @@ """ Returns a sorted list of markers users without duplicates """ markersmeta = [dict(m[3]) for m in markers] - users = set(meta['user'] for meta in markersmeta if meta.get('user')) + users = set(encoding.tolocal(meta['user']) for meta in markersmeta + if meta.get('user')) return sorted(users)