From 8f9139dd7856bf65218a9889fb1102a50b5d820c Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Fri, 3 Nov 2017 22:40:02 -0400 Subject: [PATCH] updated to support absolute paths just had to reverse the loop order so we can check for absolute paths first, before trying to construct them out of the usual suspect directories. --- scripts/core/variables.sh | 6 +- scripts/customize/fred/fred_variables.sh | 3 +- scripts/rev_control/version_control.sh | 71 +++++++++++++++--------- 3 files changed, 48 insertions(+), 32 deletions(-) diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index 962535f1..9d84f8ce 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -199,16 +199,12 @@ if [ -z "$CORE_VARIABLES_LOADED" ]; then ## # establish a pipe for less to see our beloved syntax highlighting. ## define_yeti_variable LESSOPEN="| source-highlight -f esc -o STDOUT -i %s" - # ensure we use the right kind of secure shell. -# define_yeti_variable CVS_RSH=$FEISTY_MEOW_SCRIPTS/security/ssh.sh -# define_yeti_variable GIT_SSH=$FEISTY_MEOW_SCRIPTS/security/ssh.sh - # the base checkout list is just to update feisty_meow. additional folder # names can be added in your customized scripts. the space at the end of # this variable is important and allows users to extend the list like: # define_yeti_variable REPOSITORY_DIR+="muppets configs" # see the customize/fred folder for a live example. - define_yeti_variable REPOSITORY_LIST= + define_yeti_variable REPOSITORY_LIST="$FEISTY_MEOW_APEX " # the archive collections list is a set of directories that are major # repositories of data which can be synched to backup drives. diff --git a/scripts/customize/fred/fred_variables.sh b/scripts/customize/fred/fred_variables.sh index a71d61ae..0530dba2 100644 --- a/scripts/customize/fred/fred_variables.sh +++ b/scripts/customize/fred/fred_variables.sh @@ -15,7 +15,8 @@ if [ -z "$USER_CUSTOMIZATIONS_LOADED" ]; then fi # add a bunch of personal folders to the list for checkin & checkout. - REPOSITORY_LIST+="$(basename $FEISTY_MEOW_APEX) cloud ebooks web active/webwork" + REPOSITORY_LIST+="cloud ebooks web active/webwork" +#feisty is back in the default list $(basename $FEISTY_MEOW_APEX) # adds our locally relevant archive folders into the list to be synched. ARCHIVE_COLLECTIONS_LIST+="/z/basement /z/imaginations /z/musix /z/toaster /z/walrus" diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index b28d6f30..e721a5e6 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -209,17 +209,29 @@ function checkin_list() save_terminal_title - for i in $list; do - # turn repo list back into an array. - eval "repository_list=( ${REPOSITORY_LIST[*]} )" - for j in "${repository_list[@]}"; do - # add in the directory component. - j="$i/$j" - if [ ! -d "$j" ]; then continue; fi - echo "checking in '$j'..." - do_checkin $j + # turn repo list back into an array. + eval "repository_list=( ${REPOSITORY_LIST[*]} )" + + local outer inner + + for outer in "${repository_list[@]}"; do + # check the repository first, since it might be an absolute path. + if [[ $outer =~ /.* ]]; then + # yep, this path is absolute. just handle it directly. + if [ ! -d "$outer" ]; then continue; fi + echo "checking in '$outer'..." + do_checkin $outer sep 7 - done + else + for inner in $list; do + # add in the directory component to see if we can find the folder. + local path="$inner/$outer" + if [ ! -d "$path" ]; then continue; fi + echo "checking in '$path'..." + do_checkin $path + sep 7 + done + fi done restore_terminal_title @@ -279,22 +291,29 @@ function checkout_list() save_terminal_title - for i in $list; do - # turn repo list back into an array. - eval "repository_list=( ${REPOSITORY_LIST[*]} )" - for j in "${repository_list[@]}"; do - # add in the directory for our purposes here. - j="$i/$j" - if [ ! -d $j ]; then - if [ ! -z "$SHELL_DEBUG" ]; then - echo "no directory called $j exists." - fi - continue - fi - - echo -n "retrieving '$j'... " - do_update $j - done + # turn repo list back into an array. + eval "repository_list=( ${REPOSITORY_LIST[*]} )" + + local outer inner + + for outer in "${repository_list[@]}"; do + # check the repository first, since it might be an absolute path. + if [[ $outer =~ /.* ]]; then + # yep, this path is absolute. just handle it directly. + if [ ! -d "$outer" ]; then continue; fi + echo "retrieving '$outer'..." + do_update $outer + sep 7 + else + for inner in $list; do + # add in the directory component to see if we can find the folder. + local path="$inner/$outer" + if [ ! -d "$path" ]; then continue; fi + echo "retrieving '$path'..." + do_update $path + sep 7 + done + fi done restore_terminal_title -- 2.34.1