From 613a9e8ddf1498a7c41d6b49c278896d80c69560 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Thu, 6 Aug 2020 11:58:06 -0400 Subject: [PATCH] added a lister for active branches called branchy very limited so far; only supports git. also a bit weird since derived from puffer which follows our whacky repository list variable stuff. --- scripts/rev_control/branchy.sh | 33 ++++++++++++++++++++++++++ scripts/rev_control/version_control.sh | 17 +++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 scripts/rev_control/branchy.sh diff --git a/scripts/rev_control/branchy.sh b/scripts/rev_control/branchy.sh new file mode 100644 index 00000000..a92d3168 --- /dev/null +++ b/scripts/rev_control/branchy.sh @@ -0,0 +1,33 @@ +#!/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. + +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" + +save_terminal_title + +############## + +echo "showing repository branches at: $(date)" + +FULL_LIST="$@" + +# only add the standard feisty meow repo list items if we were given no args on command line. +#hmmm: below seems to be oddly just major locations; is the repo list all relative names? +if [ -z "$FULL_LIST" ]; then + FULL_LIST=" $(dirname $FEISTY_MEOW_APEX) $HOME " + if [ "$OS" == "Windows_NT" ]; then + FULL_LIST+=" c:/ d:/ e:/ " + fi +fi + +show_active_branch $FULL_LIST +exit_on_error "showing branches: $FULL_LIST" + +echo + +############## + +restore_terminal_title diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index 80142d05..dcde45c6 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -280,6 +280,23 @@ function check_branch_state() return $to_return } +# showes the branch currently active in the repository. +function show_active_branch() +{ +#hmmm: if no args, assume current dir! + + for directory in "$@"; do + echo -n "active branch for '$directory': " + pushd "$directory" &>/dev/null + +#hmmm: if git... + git rev-parse --abbrev-ref HEAD +#hmmm: else OTHERS!!! + + popd &>/dev/null + done +} + # only shows the branch state if it's not okay. # note that this is not the same as a conditional branch (ha ha). function show_branch_conditionally() -- 2.34.1