mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 18:32:14 +02:00
filter-repo (python3): add a decode() function
We need a function to transform byte strings into unicode strings for printing error messages and occasional other uses. Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
2562f0270c
commit
1a8e247ba7
@ -115,6 +115,10 @@ def date_to_string(dateobj):
|
||||
return('{} {}'.format(int(_timedelta_to_seconds(dateobj - epoch)),
|
||||
dateobj.tzinfo.tzname(0)))
|
||||
|
||||
def decode(bytestr):
|
||||
'Try to convert bytestr to utf-8 for outputting as an error message.'
|
||||
return bytestr.decode('utf-8', 'backslashreplace')
|
||||
|
||||
class PathQuoting:
|
||||
_unescape = {'a': '\a',
|
||||
'b': '\b',
|
||||
|
Loading…
Reference in New Issue
Block a user