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
This commit is contained in:
@@ -392,7 +392,11 @@ if __name__ == '__main__':
|
|||||||
for i in range(0, check_picked_count):
|
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')):
|
if subprocess.call(['git', 'cat-file', '-e', 'HEAD~{0}'.format(i)], cwd=project_path, stderr=open(os.devnull, 'wb')):
|
||||||
continue
|
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:
|
if 'Change-Id:' in output:
|
||||||
head_change_id = ''
|
head_change_id = ''
|
||||||
for j,t in enumerate(reversed(output)):
|
for j,t in enumerate(reversed(output)):
|
||||||
|
|||||||
Reference in New Issue
Block a user