repo-pull: Introduce --current-branch argument
To make the script can be used from automatic scripts, introduce
`--current-branch` argument which allows pulling commits to the current
branch without creating a local branch. It will skip the prompt which
asking about the creation of a local branch.
Test: With --current-branch argument, the script doesn't ask setting
local branch name.
Change-Id: Iff3cdebe6338bb2be738e60047d5c4dd81cde4f0
Signed-off-by: Junghoon Jang <junghoonjang@google.com>
diff --git a/tools/repo_pull/repo_pull.py b/tools/repo_pull/repo_pull.py
index 3491eb9..b4bdfea 100755
--- a/tools/repo_pull/repo_pull.py
+++ b/tools/repo_pull/repo_pull.py
@@ -409,6 +409,9 @@
parser.add_argument('-j', '--parallel', default=1, type=int,
help='Number of parallel running commands')
+ parser.add_argument('--current-branch', action='store_true',
+ help='Pull commits to the current branch')
+
return parser.parse_args()
@@ -421,7 +424,7 @@
def _get_local_branch_name_from_args(args):
"""Get the local branch name from args."""
- if not args.branch and not _confirm(
+ if not args.branch and not args.current_branch and not _confirm(
'Do you want to continue without local branch name?', False):
print('error: `-b` or `--branch` must be specified', file=sys.stderr)
sys.exit(1)