Story #2515 ยป start_of_clone_feature.patch
scripts/checkout.py | ||
---|---|---|
|
||
def fetch_and_checkout(args, yaml):
|
||
repomap = dict((x['name'], x) for x in yaml['repositories'])
|
||
for repo in REPOS:
|
||
repoobj = repomap.get(repo)
|
||
if repoobj is None:
|
||
raise Exception()
|
||
checkout_path = os.path.expanduser(BASE_DIR_TEMPLATE % repo)
|
||
if os.path.exists(checkout_path):
|
||
subprocess.run(["git", "fetch", args.remote], check=True, cwd=checkout_path)
|
||
for entry in yaml['repositories']:
|
||
if entry['name'] == repo:
|
||
subprocess.run(["git", "checkout", "%s/%s" % (args.remote, entry['git_branch'])], check=True, cwd=checkout_path)
|
||
subprocess.run(["find", "./", "-name", "*.py[c0]", "-delete"], cwd=checkout_path)
|
||
if not os.path.exists(checkout_path):
|
||
cmd = ["git", "clone", repoobj['git_url']]
|
||
subprocess.run(cmd, check=True,
|
||
cwd=os.path.dirname(checkout_path))
|
||
subprocess.run(["git", "fetch", args.remote], check=True, cwd=checkout_path)
|
||
subprocess.run(["git", "checkout", "%s/%s" % (args.remote, repoobj['git_branch'])],
|
||
check=True, cwd=checkout_path)
|
||
subprocess.run(["find", "./", "-name", "*.py[c0]", "-delete"], cwd=checkout_path)
|
||
def main():
|