summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChirayu Desai <cdesai@cyanogenmod.org>2013-11-19 18:46:29 +0530
committerChirayu Desai <chirayudesai1@gmail.com>2013-11-21 06:03:22 +0000
commit0eb35cbe5096128e4a760aca6842ecdbea5baf1a (patch)
tree6134f979145140346b3eeeacfd12cbd6572f32d3
parentce201a5311c2fe90dce479ee12c078cd26ccc0c4 (diff)
downloadgit-repo-0eb35cbe5096128e4a760aca6842ecdbea5baf1a.tar.gz
Fix some python3 encoding issues
* Add .decode('utf-8') where needed * Add 'b' to `open` where needed, and remove where unnecessary Change-Id: I0f03ecf9ed1a78e3b2f15f9469deb9aaab698657
-rw-r--r--git_command.py2
-rw-r--r--git_config.py4
-rw-r--r--git_refs.py2
-rw-r--r--project.py2
-rw-r--r--subcmds/sync.py2
5 files changed, 6 insertions, 6 deletions
diff --git a/git_command.py b/git_command.py
index d347dd61..51f5e3c0 100644
--- a/git_command.py
+++ b/git_command.py
@@ -86,7 +86,7 @@ class _GitCall(object):
86 global _git_version 86 global _git_version
87 87
88 if _git_version is None: 88 if _git_version is None:
89 ver_str = git.version() 89 ver_str = git.version().decode('utf-8')
90 if ver_str.startswith('git version '): 90 if ver_str.startswith('git version '):
91 _git_version = tuple( 91 _git_version = tuple(
92 map(int, 92 map(int,
diff --git a/git_config.py b/git_config.py
index a294a0b6..f6093a25 100644
--- a/git_config.py
+++ b/git_config.py
@@ -304,8 +304,8 @@ class GitConfig(object):
304 d = self._do('--null', '--list') 304 d = self._do('--null', '--list')
305 if d is None: 305 if d is None:
306 return c 306 return c
307 for line in d.rstrip('\0').split('\0'): # pylint: disable=W1401 307 for line in d.decode('utf-8').rstrip('\0').split('\0'): # pylint: disable=W1401
308 # Backslash is not anomalous 308 # Backslash is not anomalous
309 if '\n' in line: 309 if '\n' in line:
310 key, val = line.split('\n', 1) 310 key, val = line.split('\n', 1)
311 else: 311 else:
diff --git a/git_refs.py b/git_refs.py
index 4dd68769..3c266061 100644
--- a/git_refs.py
+++ b/git_refs.py
@@ -100,7 +100,7 @@ class GitRefs(object):
100 def _ReadPackedRefs(self): 100 def _ReadPackedRefs(self):
101 path = os.path.join(self._gitdir, 'packed-refs') 101 path = os.path.join(self._gitdir, 'packed-refs')
102 try: 102 try:
103 fd = open(path, 'rb') 103 fd = open(path, 'r')
104 mtime = os.path.getmtime(path) 104 mtime = os.path.getmtime(path)
105 except IOError: 105 except IOError:
106 return 106 return
diff --git a/project.py b/project.py
index dec21ab1..66316411 100644
--- a/project.py
+++ b/project.py
@@ -1165,7 +1165,7 @@ class Project(object):
1165 last_mine = None 1165 last_mine = None
1166 cnt_mine = 0 1166 cnt_mine = 0
1167 for commit in local_changes: 1167 for commit in local_changes:
1168 commit_id, committer_email = commit.split(' ', 1) 1168 commit_id, committer_email = commit.decode('utf-8').split(' ', 1)
1169 if committer_email == self.UserEmail: 1169 if committer_email == self.UserEmail:
1170 last_mine = commit_id 1170 last_mine = commit_id
1171 cnt_mine += 1 1171 cnt_mine += 1
diff --git a/subcmds/sync.py b/subcmds/sync.py
index e9d52b7b..d8aec59b 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -761,7 +761,7 @@ class _FetchTimes(object):
761 def _Load(self): 761 def _Load(self):
762 if self._times is None: 762 if self._times is None:
763 try: 763 try:
764 f = open(self._path) 764 f = open(self._path, 'rb')
765 except IOError: 765 except IOError:
766 self._times = {} 766 self._times = {}
767 return self._times 767 return self._times