Mercurial > hg
comparison mercurial/debugcommands.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 | 0f4c2c70e26e |
children | 0a57945aaf7f |
comparison
equal
deleted
inserted
replaced
38706:83d965803325 | 38707:6b5ca1d0aa1e |
---|---|
1617 | 1617 |
1618 if precursor is not None: | 1618 if precursor is not None: |
1619 if opts['rev']: | 1619 if opts['rev']: |
1620 raise error.Abort('cannot select revision when creating marker') | 1620 raise error.Abort('cannot select revision when creating marker') |
1621 metadata = {} | 1621 metadata = {} |
1622 metadata['user'] = opts['user'] or ui.username() | 1622 metadata['user'] = encoding.fromlocal(opts['user'] or ui.username()) |
1623 succs = tuple(parsenodeid(succ) for succ in successors) | 1623 succs = tuple(parsenodeid(succ) for succ in successors) |
1624 l = repo.lock() | 1624 l = repo.lock() |
1625 try: | 1625 try: |
1626 tr = repo.transaction('debugobsolete') | 1626 tr = repo.transaction('debugobsolete') |
1627 try: | 1627 try: |