Skip to content

Commit ef300a2

Browse files
committed
checkout into known directory
1 parent 61e8273 commit ef300a2

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

management_instance/runbooks/shared_scripts/preview_merge_repo.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,20 @@ def init_argparse():
194194
print('Failed to open template/' + project_dir + '/deployment_process.ocl to check for ActionTemplates')
195195

196196
# Merge the template changes
197-
execute(['git', 'clone', new_repo_url_wth_creds])
198-
execute(['git', 'remote', 'add', 'upstream', template_repo_name_url_with_creds], cwd=new_repo)
199-
execute(['git', 'fetch', '--all'], cwd=new_repo)
200-
execute(['git', 'checkout', '-b', 'upstream-' + branch, 'upstream/' + branch], cwd=new_repo)
197+
repo_dir = 'repo'
198+
os.mkdir(repo_dir)
199+
execute(['git', 'clone', new_repo_url_wth_creds, repo_dir])
200+
execute(['git', 'remote', 'add', 'upstream', template_repo_name_url_with_creds], cwd=repo_dir)
201+
execute(['git', 'fetch', '--all'], cwd=repo_dir)
202+
execute(['git', 'checkout', '-b', 'upstream-' + branch, 'upstream/' + branch], cwd=repo_dir)
201203

202204
# Checkout the project branch, assuming "main" or "master" are already linked upstream
203205
if branch != 'master' and branch != 'main':
204-
execute(['git', 'checkout', '-b', branch, 'origin/' + branch], cwd=new_repo)
206+
execute(['git', 'checkout', '-b', branch, 'origin/' + branch], cwd=repo_dir)
205207
else:
206-
execute(['git', 'checkout', branch], cwd=new_repo)
208+
execute(['git', 'checkout', branch], cwd=repo_dir)
207209

208-
git_diff_out, _, _ = execute(['git', 'diff', 'main...upstream-main'], cwd=new_repo)
210+
git_diff_out, _, _ = execute(['git', 'diff', 'main...upstream-main'], cwd=repo_dir)
209211

210212
if len(git_diff_out) == 0:
211213
print('This project is up to date with the upstream repo at ' + template_repo_name_url)

0 commit comments

Comments
 (0)