Changeset - 3b1ef6d95d62
[Not reviewed]
default
0 1 0
Mads Kiilerich - 9 years ago 2016-07-28 16:28:34
madski@unity3d.com
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.)
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/hooks.py
Show inline comments
 
@@ -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
 

	
0 comments (0 inline, 0 general)