repopick: fix --check-picked on Python 3
This is very subtly broken: we look for the string 'Change-Id:'
in an array of byte strings. Fix this by decoding the git output
to utf-8 strings.
Change-Id: I708ad0adacb61c89bfba0fd88eeb2e37648317af
diff --git a/build/tools/repopick.py b/build/tools/repopick.py
index bf27d1d..95aabfc 100755
--- a/build/tools/repopick.py
+++ b/build/tools/repopick.py
@@ -392,7 +392,11 @@
for i in range(0, check_picked_count):
if subprocess.call(['git', 'cat-file', '-e', 'HEAD~{0}'.format(i)], cwd=project_path, stderr=open(os.devnull, 'wb')):
continue
- output = subprocess.check_output(['git', 'show', '-q', 'HEAD~{0}'.format(i)], cwd=project_path).split()
+ output = subprocess.check_output(['git', 'show', '-q', 'HEAD~{0}'.format(i)], cwd=project_path)
+ # make sure we have a string on Python 3
+ if isinstance(output, bytes):
+ output = output.decode('utf-8')
+ output = output.split()
if 'Change-Id:' in output:
head_change_id = ''
for j,t in enumerate(reversed(output)):