Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/tests/data/generate_repo.py
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | def generate_repo(repo_desc, output_dir): | ||||
) | ) | ||||
for rev_d in repo_desc: | for rev_d in repo_desc: | ||||
parents = rev_d.get("parents") | parents = rev_d.get("parents") | ||||
if parents: | if parents: | ||||
# move at the proper (first) parent position, if any | # move at the proper (first) parent position, if any | ||||
check_call(["git", "checkout", parents[0]], stdout=PIPE) | check_call(["git", "checkout", parents[0]], stdout=PIPE) | ||||
# give a branch name (the msg) to each commit to make it esier to | # give a branch name (the msg) to each commit to make it easier to | ||||
# navigate in history | # navigate in history | ||||
check_call(["git", "checkout", "-b", rev_d["msg"]], stdout=PIPE) | check_call(["git", "checkout", "-b", rev_d["msg"]], stdout=PIPE) | ||||
if parents and len(parents) > 1: | if parents and len(parents) > 1: | ||||
# it's a merge | # it's a merge | ||||
check_call(["git", "merge", "--no-commit", *parents[1:]], stdout=PIPE) | check_call(["git", "merge", "--no-commit", *parents[1:]], stdout=PIPE) | ||||
clean_wd() | clean_wd() | ||||
Show All 38 Lines |