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
gugelfrei
Simon Shields 5 years ago
parent 15d91cd200
commit d5e35c9dda

@ -392,7 +392,11 @@ if __name__ == '__main__':
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)):

Loading…
Cancel
Save