MCPcopy Index your code
hub / github.com/openstack/openstack / gen_gitmodules

Function gen_gitmodules

generate-gitmodules.py:41–59  ·  view source on GitHub ↗
(projects)

Source from the content-addressed store, hash-verified

39
40
41def gen_gitmodules(projects):
42 path_template = "https://opendev.org/{project}"
43 short_projects = []
44 for project in projects:
45 short = os.path.basename(project)
46 short_projects.append(short)
47 path = path_template.format(project=project)
48 if not os.path.isdir(short):
49 os.system('git submodule add {path}'.format(path=path))
50 for existing in os.listdir('.'):
51 if not os.path.isdir(existing) or existing.startswith('.'):
52 continue
53 if existing not in short_projects:
54 os.system('git rm {existing}'.format(existing=existing))
55 projects = sorted(projects)
56 with open(".gitmodules", 'w') as f:
57 for p in projects:
58 ns, name = p.split('/')
59 f.write(TEMPLATE % (name, name, p))
60
61
62def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…