Merge pull request #274 from blodone/master

fix utf8 and python3
master
Martin Gondermann 10 years ago committed by GitHub
commit e6708c318f
  1. 30
      gitstatus.py

@ -21,7 +21,11 @@ __all__ = ["Print"]
try:
Print = eval("print") # python 3.0 case
except SyntaxError:
python_version = 3
to_str = str
except SyntaxError as e:
python_version = 2
to_str = unicode
D = dict()
try:
exec ("from __future__ import print_function\np=print", D)
@ -126,14 +130,24 @@ else:
if remote == "":
remote = '.'
if python_version == 2:
remote = remote.decode('utf-8')
out = '\n'.join([
branch,
remote.decode('utf-8'),
str(len(staged)),
str(len(conflicts)),
str(len(changed)),
str(len(untracked)),
str(stashed),
str(clean)
remote,
to_str(len(staged)),
to_str(len(conflicts)),
to_str(len(changed)),
to_str(len(untracked)),
to_str(stashed),
to_str(clean),
to_str(python_version),
])
if python_version == 2:
Print(out.encode('utf-8'))
else:
Print(out)

Loading…
Cancel
Save