From 5e1f64602bd11fc24c72f0617c362aa7ab79f0d8 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 26 Oct 2021 15:52:51 -0400 Subject: [PATCH] scripts: Add -M option to git-list-tor-branches.sh Omit all "maint" branch. It is the opposite of -R that omits release branches. In other words, -M can be used to list all release branches. Signed-off-by: David Goulet --- scripts/git/git-list-tor-branches.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/git/git-list-tor-branches.sh b/scripts/git/git-list-tor-branches.sh index 62547dcc5d..29e91dd1b6 100755 --- a/scripts/git/git-list-tor-branches.sh +++ b/scripts/git/git-list-tor-branches.sh @@ -8,7 +8,7 @@ SCRIPT_NAME=$(basename "$0") function usage() { - echo "$SCRIPT_NAME [-h] [-l|-s|-b|-m] [-R]" + echo "$SCRIPT_NAME [-h] [-l|-s|-b|-m] [-R|-M]" echo echo " arguments:" echo " -h: show this help text" @@ -20,6 +20,7 @@ function usage() echo " ( branch parent path suffix parent_suffix ) arrays" echo echo " -R: omit release branches." + echo " -M: omit maint branches." } # list : just a list of branch names. @@ -27,9 +28,10 @@ function usage() # suffix: write a list of suffixes. # merge: branch, upstream, path, suffix, upstream suffix. mode="list" +skip_maint_branches="no" skip_release_branches="no" -while getopts "hblmsR" opt ; do +while getopts "hblmsRM" opt ; do case "$opt" in h) usage exit 0 @@ -42,6 +44,8 @@ while getopts "hblmsR" opt ; do ;; m) mode="merge" ;; + M) skip_maint_branches="yes" + ;; R) skip_release_branches="yes" ;; *) echo "Unknown option" @@ -80,6 +84,9 @@ branch() { suffix="_${brname_nodots#maint-}" location="\$GIT_PATH/\$TOR_WKT_NAME/$brname" is_maint="yes" + if [[ "$skip_maint_branches" = "yes" ]]; then + return + fi elif [[ "$brname" =~ ^release- ]]; then suffix="_r${brname_nodots#release-}" location="\$GIT_PATH/\$TOR_WKT_NAME/$brname"