parent
15d4e61f65
commit
da30e73ed1
|
@ -5,6 +5,9 @@ class DataBuffer(Buffer):
|
||||||
def __init__(self, name, data):
|
def __init__(self, name, data):
|
||||||
Buffer.__init__(self)
|
Buffer.__init__(self)
|
||||||
self._name = name
|
self._name = name
|
||||||
|
if type(data) == bytes:
|
||||||
|
self.lines = data.decode('UTF-8').split('\n')
|
||||||
|
else:
|
||||||
self.lines = data.split("\n")
|
self.lines = data.split("\n")
|
||||||
def name(self):
|
def name(self):
|
||||||
return self._name
|
return self._name
|
||||||
|
|
|
@ -186,7 +186,7 @@ class GitBlame(VcBlame):
|
||||||
if not m:
|
if not m:
|
||||||
raise VcException("couldn't parse %r" % line)
|
raise VcException("couldn't parse %r" % line)
|
||||||
groups = m.groups()
|
groups = m.groups()
|
||||||
fields = [s.decode('UTF-8') for s in groups[:-1]]
|
fields = list(groups[:-1])
|
||||||
del fields[1]
|
del fields[1]
|
||||||
if fields[1] == 'Not Committed Yet':
|
if fields[1] == 'Not Committed Yet':
|
||||||
fields[1] = ''
|
fields[1] = ''
|
||||||
|
|
13
util.py
13
util.py
|
@ -137,12 +137,13 @@ except:
|
||||||
dict.__repr__(self))
|
dict.__repr__(self))
|
||||||
|
|
||||||
def decode(s):
|
def decode(s):
|
||||||
for coding in ('utf-8', 'latin-1'):
|
return s
|
||||||
try:
|
#for coding in ('utf-8', 'latin-1'):
|
||||||
return s.decode(coding)
|
# try:
|
||||||
except:
|
# return s.decode(coding)
|
||||||
pass
|
# except:
|
||||||
return s.decode('ascii', 'replace')
|
# pass
|
||||||
|
#return s.decode('ascii', 'replace')
|
||||||
|
|
||||||
def communicate(cmd, stdin=None, stderr=True, shell=False):
|
def communicate(cmd, stdin=None, stderr=True, shell=False):
|
||||||
if stderr:
|
if stderr:
|
||||||
|
|
Loading…
Reference in New Issue