Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.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 | 572dff5c946e |
children | e252f136b948 |
comparison
equal
deleted
inserted
replaced
38706:83d965803325 | 38707:6b5ca1d0aa1e |
---|---|
2553 # Reroute the working copy parent to the new changeset | 2553 # Reroute the working copy parent to the new changeset |
2554 repo.setparents(newid, nullid) | 2554 repo.setparents(newid, nullid) |
2555 mapping = {old.node(): (newid,)} | 2555 mapping = {old.node(): (newid,)} |
2556 obsmetadata = None | 2556 obsmetadata = None |
2557 if opts.get('note'): | 2557 if opts.get('note'): |
2558 obsmetadata = {'note': opts['note']} | 2558 obsmetadata = {'note': encoding.fromlocal(opts['note'])} |
2559 scmutil.cleanupnodes(repo, mapping, 'amend', metadata=obsmetadata, | 2559 scmutil.cleanupnodes(repo, mapping, 'amend', metadata=obsmetadata, |
2560 fixphase=True, targetphase=commitphase) | 2560 fixphase=True, targetphase=commitphase) |
2561 | 2561 |
2562 # Fixing the dirstate because localrepo.commitctx does not update | 2562 # Fixing the dirstate because localrepo.commitctx does not update |
2563 # it. This is rather convenient because we did not need to update | 2563 # it. This is rather convenient because we did not need to update |