Handle checkout errors

This commit is contained in:
Tom 2021-02-12 15:21:13 +01:00 committed by nicolas-harraudeau-sonarsource
parent 9278ff4c96
commit 8889f43a1e

View File

@ -64,7 +64,12 @@ def checkout(repo,version,batch_mode):
for tag in git_repo.tags:
if not '-' in tag.name:
print(f"{repo} {tag.name}")
g.checkout(tag.name)
try:
g.checkout(tag.name)
except Exception:
print("checkout failed, resetting and cleaning")
g.reset('--hard',tag)
g.clean('-xfd')
dump_rules(repo,tag.name)
os.chdir('..')
else: