summaryrefslogtreecommitdiffstats
path: root/releases/scripts/repos.py
diff options
context:
space:
mode:
authorAric Gardner <agardner@linuxfoundation.org>2018-09-19 16:28:39 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-09-19 16:28:39 +0000
commit274c96e6bfa3e50737aeaadafb20bb048a897818 (patch)
tree52aa05c99719a6c09e73f20484e10cc53d00505e /releases/scripts/repos.py
parentbfa5bcc3bacac5d18a936a875595078fc52035b5 (diff)
parentc0c6f23c2c494cefa01398f6c18e95af4c801d1a (diff)
Merge "Create branches via ssh rather than the https"
Diffstat (limited to 'releases/scripts/repos.py')
-rw-r--r--releases/scripts/repos.py31
1 files changed, 29 insertions, 2 deletions
diff --git a/releases/scripts/repos.py b/releases/scripts/repos.py
index 47ce42d88..91c4e9300 100644
--- a/releases/scripts/repos.py
+++ b/releases/scripts/repos.py
@@ -63,20 +63,28 @@ def main():
type=str,
help="Only print"
"SHAs for the specified release")
+ parser.add_argument('--branches', '-b',
+ action='store_true',
+ default=False,
+ help="Print Branch info")
+
args = parser.parse_args()
project = yaml.safe_load(args.file)
- list_repos(project, args)
+ if args.branches:
+ list_branches(project, args)
+ else:
+ list_repos(project, args)
def list_repos(project, args):
"""List repositories in the project file"""
lookup = project.get('releases', [])
+
if 'releases' not in project:
exit(0)
-
repos = set()
for item in lookup:
repo, ref = next(iter(item['location'].items()))
@@ -90,5 +98,24 @@ def list_repos(project, args):
print(repo)
+def list_branches(project, args):
+ """List branches in the project file"""
+
+ lookup = project.get('branches', [])
+
+ if 'branches' not in project:
+ exit(0)
+ repos = set()
+ for item in lookup:
+ repo, ref = next(iter(item['location'].items()))
+ if args.names:
+ repos.add(Repo(repo))
+ elif args.release and item['name'] == args.release:
+ repos.add(Repo(repo, ref))
+ elif not args.release:
+ repos.add(Repo(repo, item['name'], ref))
+ for repo in repos:
+ print(repo)
+
if __name__ == "__main__":
main()