diff --git a/dev-tools/scripts/reproduceJenkinsFailures.py b/dev-tools/scripts/reproduceJenkinsFailures.py index 70f0c43fbde..edfe2d4570e 100644 --- a/dev-tools/scripts/reproduceJenkinsFailures.py +++ b/dev-tools/scripts/reproduceJenkinsFailures.py @@ -158,7 +158,11 @@ def prepareWorkspace(useGit, gitRef): checkoutCmd = 'git checkout %s' % gitRef code = run(checkoutCmd) if 0 != code: - raise RuntimeError('ERROR: "%s" failed. See above.' % checkoutCmd) + checkoutBranchCmd = 'git checkout -t -b %s origin/%s' % (gitRef, gitRef) # Checkout remote branch as new local branch + print('"%s" failed. Trying "%s".' % (checkoutCmd, checkoutBranchCmd)) + code = run(checkoutBranchCmd) + if 0 != code: + raise RuntimeError('ERROR: "%s" failed. See above.' % checkoutBranchCmd) gitCheckoutSucceeded = True run('git merge --ff-only', rememberFailure=False) # Ignore failure on non-branch ref