From 74bd5d56582976a10b359b512ae402991d9b64d3 Mon Sep 17 00:00:00 2001 From: Steve Rowe Date: Tue, 19 Jun 2018 22:21:26 -0400 Subject: [PATCH] Handle the case of checking out a remote branch that has never been checked out locally before --- dev-tools/scripts/reproduceJenkinsFailures.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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