Merge branch 'release-2.140.136'
[feisty_meow.git] / scripts / rev_control / branchy.sh
index 15ec7702429adf5c23219041140e5ed0d50e6dbc..98e21387c5c0f4b28f3457cedf86877a36fe6754 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
-# branchy: lists the branches active on all of the folders present in the
-# REPOSITORY_LIST variable or in paths provided on the command line.
+# branchy: lists the branches active on all of the paths provided on the command line.
+# if no directory is specified, this defaults to operating on the current directory.
 
 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
 source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh"
@@ -10,15 +10,29 @@ save_terminal_title
 
 ##############
 
-FULL_LIST="$@"
-
-# use the current directory if no paths were provided.
-if [ -z "$FULL_LIST" ]; then
-  FULL_LIST="."
+## holding old implem:
+#FULL_LIST="$@"
+## use the current directory if no paths were provided.
+#if [ -z "$FULL_LIST" ]; then
+#  FULL_LIST="."
+#fi#
+#show_active_branch $FULL_LIST
+#exit_on_error "showing branches: $FULL_LIST"
+
+dir="$1"; shift
+if [ -z "$dir" ]; then
+  dir=.
 fi
 
-show_active_branch $FULL_LIST
-exit_on_error "showing branches: $FULL_LIST"
+pushd "$dir" &>/dev/null
+exit_on_error "changing to directory: $dir"
+tempfile=$(generate_rev_ctrl_filelist)
+popd &>/dev/null
+
+perform_revctrl_action_on_file "$tempfile" show_active_branch
+exit_on_error "performing revision control action show_active_branch on: $tempfile"
+
+rm "$tempfile"
 
 ##############