diff options
Diffstat (limited to 'scripts/llvm.py')
-rw-r--r-- | scripts/llvm.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/scripts/llvm.py b/scripts/llvm.py index 829c720..2252ab2 100644 --- a/scripts/llvm.py +++ b/scripts/llvm.py @@ -3,11 +3,12 @@ import os from sys import exit -from modules.llvm import LLVMSubproject, LLVMSourceConfig +from modules.llvm import LLVMSubproject, LLVMSourceConfig, push_current_branch from linaropy.git.clone import Clone from linaropy.proj import Proj from argparse import Action, ArgumentParser, RawTextHelpFormatter +from functools import partial def die(message, config_to_dump=None): @@ -64,6 +65,22 @@ def projects(args): dump_config(config) + +def push_branch(args): + """Push current branch to origin.""" + + proj = Proj() + + llvm_worktree_root = get_worktree_root(args.env) + config = LLVMSourceConfig(proj, llvm_worktree_root) + + llvmBranch = Clone(proj, llvm_worktree_root).getbranch() + + try: + config.for_each_enabled(partial(push_current_branch, proj)) + except RuntimeError as exc: + die("Failed to push branch because: " + str(exc) + str(exc.__cause__)) + ########################################################################## # Command line parsing # ########################################################################## @@ -106,5 +123,11 @@ projs.add_argument( metavar='subproject', help="Unlink given subprojects.") +# Subcommand for pushing the current branch to origin +push = subcommands.add_parser( + "push", + help="Push current branch to origin linaro-local/<user>/<branch>, for all linked subprojects.") +push.set_defaults(run_command=push_branch) + args = options.parse_args() args.run_command(args) |