Skip to content
Snippets Groups Projects
Commit 8ac6b154 authored by dam1n19's avatar dam1n19
Browse files

Added recursive projbranch files

parent 50598902
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
import argparse import argparse
import os import os
from os.path import exists
class git_repo(): class git_repo():
def __init__(self, directory, branch): def __init__(self, directory, branch):
self.directory = directory self.directory = directory
...@@ -28,10 +30,19 @@ def read_branchfile(branchfile): ...@@ -28,10 +30,19 @@ def read_branchfile(branchfile):
sub_repos.append(git_repo(repo[0],repo[1])) sub_repos.append(git_repo(repo[0],repo[1]))
return sub_repos return sub_repos
def find_branchfile(directory, branchfile):
if exists(f"{directory}/{branchfile}"):
print(f"Found Branchfile in {directory}")
sub_repos = read_branchfile(f"{directory}/{branchfile}")
for repo in sub_repos:
print(f"Subrepo found: {repo.directory}")
repo_checkout(f"{directory}/{repo.directory}", repo.branch, branchfile)
def repo_checkout(directory, branch): def repo_checkout(directory, branch, branchfile):
print(f"Checking out {directory} to branch {branch}") print(f"Checking out {directory} to branch {branch}")
os.system(f"cd {directory}; git checkout {branch}") os.system(f"cd {directory}; git checkout {branch}")
find_branchfile(directory, branchfile)
if __name__ == "__main__": if __name__ == "__main__":
# Capture Arguments from Command Line # Capture Arguments from Command Line
...@@ -41,4 +52,4 @@ if __name__ == "__main__": ...@@ -41,4 +52,4 @@ if __name__ == "__main__":
args = parser.parse_args() args = parser.parse_args()
sub_repos = read_branchfile(args.branchfile) sub_repos = read_branchfile(args.branchfile)
for repo in sub_repos: for repo in sub_repos:
repo_checkout(repo.directory, repo.branch) repo_checkout(repo.directory, repo.branch, args.branchfile)
#-----------------------------------------------------------------------------
# SoC Labs Sub repository branch setup
# A joint work commissioned on behalf of SoC Labs, under Arm Academic Access license.
#
# Contributors
#
# David Mapstone (d.a.mapstone@soton.ac.uk)
#
# Copyright 2023, SoC Labs (www.soclabs.org)
#-----------------------------------------------------------------------------
# Each Repo needs to have its branch set manually in here - they will defaultly be checked out to main
tools/chipkit_flow: main
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment