[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/main] scripts: Add -M option to git-list-tor-branches.sh



commit 5e1f64602bd11fc24c72f0617c362aa7ab79f0d8
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date:   Tue Oct 26 15:52:51 2021 -0400

    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 <dgoulet@xxxxxxxxxxxxxx>
---
 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"

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits