# HG changeset patch # User Mads Kiilerich # Date 2016-07-28 16:28:34 # Node ID 3b1ef6d95d62d560af3272c8fc6fd5eb436fe0fb # Parent 5a38b9084a9e284b9d37000cdb20d817846bc2a8 hooks: always convert unicode to byte strings when passed to ui.status Kallithea generally uses unicode strings internally, but ui.status follows the Mercurial convention and expects a byte string. Strings passed to ui.status should thus always by converted to byte strings. Do that explicitly with safe_str. (The alternative of using more byte strings internally seems less appealing.) diff --git a/kallithea/lib/hooks.py b/kallithea/lib/hooks.py --- a/kallithea/lib/hooks.py +++ b/kallithea/lib/hooks.py @@ -99,7 +99,7 @@ def pre_push(ui, repo, **kwargs): _http_ret = HTTPLockedRC(ex.repository, locked_by) if str(_http_ret.code).startswith('2'): #2xx Codes don't raise exceptions - ui.status(_http_ret.title) + ui.status(safe_str(_http_ret.title)) else: raise _http_ret @@ -114,7 +114,7 @@ def pre_pull(ui, repo, **kwargs): _http_ret = HTTPLockedRC(ex.repository, locked_by) if str(_http_ret.code).startswith('2'): #2xx Codes don't raise exceptions - ui.status(_http_ret.title) + ui.status(safe_str(_http_ret.title)) else: raise _http_ret @@ -149,7 +149,7 @@ def log_pull_action(ui, repo, **kwargs): _http_ret = HTTPLockedRC(ex.repository, locked_by) if str(_http_ret.code).startswith('2'): #2xx Codes don't raise exceptions - ui.status(_http_ret.title) + ui.status(safe_str(_http_ret.title)) return 0 @@ -204,7 +204,7 @@ def log_push_action(ui, repo, **kwargs): _http_ret = HTTPLockedRC(ex.repository, locked_by) if str(_http_ret.code).startswith('2'): #2xx Codes don't raise exceptions - ui.status(_http_ret.title) + ui.status(safe_str(_http_ret.title)) return 0