mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Fix some python3 encoding issues
* Add .decode('utf-8') where needed * Add 'b' to `open` where needed, and remove where unnecessary Change-Id: I0f03ecf9ed1a78e3b2f15f9469deb9aaab698657
This commit is contained in:
parent
ce201a5311
commit
0eb35cbe50
@ -86,7 +86,7 @@ class _GitCall(object):
|
||||
global _git_version
|
||||
|
||||
if _git_version is None:
|
||||
ver_str = git.version()
|
||||
ver_str = git.version().decode('utf-8')
|
||||
if ver_str.startswith('git version '):
|
||||
_git_version = tuple(
|
||||
map(int,
|
||||
|
@ -304,7 +304,7 @@ class GitConfig(object):
|
||||
d = self._do('--null', '--list')
|
||||
if d is None:
|
||||
return c
|
||||
for line in d.rstrip('\0').split('\0'): # pylint: disable=W1401
|
||||
for line in d.decode('utf-8').rstrip('\0').split('\0'): # pylint: disable=W1401
|
||||
# Backslash is not anomalous
|
||||
if '\n' in line:
|
||||
key, val = line.split('\n', 1)
|
||||
|
@ -100,7 +100,7 @@ class GitRefs(object):
|
||||
def _ReadPackedRefs(self):
|
||||
path = os.path.join(self._gitdir, 'packed-refs')
|
||||
try:
|
||||
fd = open(path, 'rb')
|
||||
fd = open(path, 'r')
|
||||
mtime = os.path.getmtime(path)
|
||||
except IOError:
|
||||
return
|
||||
|
@ -1165,7 +1165,7 @@ class Project(object):
|
||||
last_mine = None
|
||||
cnt_mine = 0
|
||||
for commit in local_changes:
|
||||
commit_id, committer_email = commit.split(' ', 1)
|
||||
commit_id, committer_email = commit.decode('utf-8').split(' ', 1)
|
||||
if committer_email == self.UserEmail:
|
||||
last_mine = commit_id
|
||||
cnt_mine += 1
|
||||
|
@ -761,7 +761,7 @@ class _FetchTimes(object):
|
||||
def _Load(self):
|
||||
if self._times is None:
|
||||
try:
|
||||
f = open(self._path)
|
||||
f = open(self._path, 'rb')
|
||||
except IOError:
|
||||
self._times = {}
|
||||
return self._times
|
||||
|
Loading…
Reference in New Issue
Block a user