diff options
Diffstat (limited to 'scripts/llvm.py')
-rw-r--r-- | scripts/llvm.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/llvm.py b/scripts/llvm.py index 2252ab2..3244bde 100644 --- a/scripts/llvm.py +++ b/scripts/llvm.py @@ -3,7 +3,11 @@ import os from sys import exit -from modules.llvm import LLVMSubproject, LLVMSourceConfig, push_current_branch +from modules.llvm import LLVMSubproject +from modules.llvm import LLVMSourceConfig +from modules.llvm import get_remote_branch +from modules.llvm import push_branch + from linaropy.git.clone import Clone from linaropy.proj import Proj @@ -66,7 +70,7 @@ def projects(args): dump_config(config) -def push_branch(args): +def push_current_branch(args): """Push current branch to origin.""" proj = Proj() @@ -74,13 +78,18 @@ def push_branch(args): llvm_worktree_root = get_worktree_root(args.env) config = LLVMSourceConfig(proj, llvm_worktree_root) - llvmBranch = Clone(proj, llvm_worktree_root).getbranch() + llvm_worktree = Clone(proj, llvm_worktree_root) + local_branch = llvm_worktree.getbranch() try: - config.for_each_enabled(partial(push_current_branch, proj)) - except RuntimeError as exc: + remote_branch = get_remote_branch(llvm_worktree, local_branch) + config.for_each_enabled(partial(push_branch, proj, local_branch, + remote_branch)) + print("Pushed to {}".format(remote_branch)) + except (EnvironmentError, RuntimeError) as exc: die("Failed to push branch because: " + str(exc) + str(exc.__cause__)) + ########################################################################## # Command line parsing # ########################################################################## @@ -127,7 +136,7 @@ projs.add_argument( 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) +push.set_defaults(run_command=push_current_branch) args = options.parse_args() args.run_command(args) |