experimental/tools/pdf-comparison: delete worktree when it gets into a bad state
No-Try: true Change-Id: I61f48fd32348d44a2c7e27d56e404f7876bed3ef Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245161 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
parent
1ffc2e453b
commit
a7914a8726
@ -20,6 +20,7 @@ cp out/default/pdfium_test ~/bin/
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
@ -201,9 +202,12 @@ def checkout_worktree(checkoutable):
|
||||
directory = os.path.join(tempfile.gettempdir(), 'skpdf_control_tree')
|
||||
commit = check_output(['git', 'rev-parse', checkoutable]).strip()
|
||||
if os.path.isdir(directory):
|
||||
check_call(['git', 'checkout', commit], cwd=directory)
|
||||
else:
|
||||
check_call(['git', 'worktree', 'add', directory, commit])
|
||||
try:
|
||||
check_call(['git', 'checkout', commit], cwd=directory)
|
||||
return directory
|
||||
except subprocess.CalledProcessError:
|
||||
shutil.rmtree(directory)
|
||||
check_call(['git', 'worktree', 'add', '-f', directory, commit])
|
||||
return directory
|
||||
|
||||
def build_skia(directory, executable):
|
||||
|
Loading…
Reference in New Issue
Block a user