"""Create identical synthetic inputs in two checkouts. Run before the UI actions.
Pass a new GitLab project clone URL and each checkout directory as arguments.
No credentials are printed or stored by this script.
"""
import pathlib, subprocess, sys
url, *checkouts = sys.argv[1:]
def git(cwd, *args):
    subprocess.run(['git','-C',str(cwd),*args],check=True)
for index, checkout in enumerate(checkouts):
    repo=pathlib.Path(checkout)/'snap-mr-fixture'
    git(checkout,'clone',url,str(repo))
    if index==0:
        git(repo,'switch','-c','evidence-create')
        git(repo,'-c','user.name=Evidence','-c','user.email=evidence@example.com','commit','--allow-empty','-m','Add synthetic MR evidence')
        (repo/'evidence.txt').write_text('Synthetic merge request evidence.\n')
        git(repo,'add','evidence.txt')
        git(repo,'-c','user.name=Evidence','-c','user.email=evidence@example.com','commit','-m','Add example content')
        git(repo,'push','-u','origin','evidence-create')
    else:
        git(repo,'switch','evidence-create')

# For the second flow, prepare each clone before clicking Commit, push & MR.
# git switch -c evidence-commit-push origin/main
# git config user.name Evidence
# git config user.email evidence@example.com
# Write example.txt: Synthetic uncommitted content for Commit, push & MR.\n
