Mercurial > kallithea
changeset 6043:5a38b9084a9e
hooks: fix encoding problems of lock release ui messages
The vcs test test_push_unlocks_repository_hg would fail when waitress tried to
append a unicode chunk to the byte stream. The unicode string came from the
'Released lock on repo' message passed to ui.status from the push hook.
ui.status do however follow the Mercurial convention and expects a byte string.
We solve the problem by applying safe_str.
Patch modified by Mads Kiilerich.
author | domruf <dominikruf@gmail.com> |
---|---|
date | Wed, 15 Jun 2016 18:33:27 +0200 |
parents | 4949076c8bb2 |
children | 3b1ef6d95d62 |
files | kallithea/lib/hooks.py kallithea/tests/other/manual_test_vcs_operations.py |
diffstat | 2 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/hooks.py Thu Jul 28 16:28:34 2016 +0200 +++ b/kallithea/lib/hooks.py Wed Jun 15 18:33:27 2016 +0200 @@ -197,8 +197,7 @@ if ex.make_lock is not None and not ex.make_lock: Repository.unlock(Repository.get_by_repo_name(ex.repository)) - msg = 'Released lock on repo `%s`\n' % ex.repository - ui.status(msg) + ui.status(safe_str('Released lock on repo `%s`\n' % ex.repository)) if ex.locked_by[0]: locked_by = User.get(ex.locked_by[0]).username
--- a/kallithea/tests/other/manual_test_vcs_operations.py Thu Jul 28 16:28:34 2016 +0200 +++ b/kallithea/tests/other/manual_test_vcs_operations.py Wed Jun 15 18:33:27 2016 +0200 @@ -483,7 +483,7 @@ #push is ok and repo is now unlocked stdout, stderr = _add_files_and_push('hg', DEST, clone_url=clone_url.split()[0]) - assert ('remote: Released lock on repo `%s`' % fork_name) in stdout + assert str('remote: Released lock on repo `%s`' % fork_name) in stdout #we need to cleanup the Session Here ! Session.remove() r = Repository.get_by_repo_name(fork_name)