From: Chris Koeritz Date: Tue, 22 May 2018 15:01:24 +0000 (-0400) Subject: naming fixes, terminal title fixes X-Git-Tag: 2.140.112^2~7 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=6d75b43bb2eb13a67e8a444bf6c07807435e2aa7;p=feisty_meow.git naming fixes, terminal title fixes made the names for revision control a lot more cohesive. fixed the save terminal stuff by only doing it at the outer boundaries of our revision control commands, rather than mixing it all through the bash library functions for version control. --- diff --git a/scripts/rev_control/checkin.sh b/scripts/rev_control/checkin.sh index 5519f68b..5c254b86 100644 --- a/scripts/rev_control/checkin.sh +++ b/scripts/rev_control/checkin.sh @@ -5,6 +5,8 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" +save_terminal_title + ############## echo "committing repositories at: $(date)" @@ -25,3 +27,5 @@ regenerate ############## +restore_terminal_title + diff --git a/scripts/rev_control/compact_git.sh b/scripts/rev_control/compact_git.sh index 5d32cc6d..8f13c057 100644 --- a/scripts/rev_control/compact_git.sh +++ b/scripts/rev_control/compact_git.sh @@ -5,6 +5,8 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" +save_terminal_title + ############## prune_dir="$1" @@ -27,3 +29,5 @@ exit_on_error "git repack" popd &>/dev/null +restore_terminal_title + diff --git a/scripts/rev_control/diff_repos.sh b/scripts/rev_control/diff_repos.sh index c0d01e51..32a5d48c 100644 --- a/scripts/rev_control/diff_repos.sh +++ b/scripts/rev_control/diff_repos.sh @@ -8,6 +8,8 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" +save_terminal_title + ############## dir="$1"; shift @@ -20,6 +22,8 @@ exit_on_error "changing to directory: $dir" tempfile=$(generate_rev_ctrl_filelist) popd &>/dev/null -perform_revctrl_action_on_file "$tempfile" do_diff -exit_on_error "performing revision control action do_diff on: $tempfile" +perform_revctrl_action_on_file "$tempfile" do_revctrl_diff +exit_on_error "performing revision control action do_revctrl_diff on: $tempfile" + +restore_terminal_title diff --git a/scripts/rev_control/getem.sh b/scripts/rev_control/getem.sh index da9cb391..e0fcdef3 100644 --- a/scripts/rev_control/getem.sh +++ b/scripts/rev_control/getem.sh @@ -5,6 +5,8 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" +save_terminal_title + ############## # trickery to ensure we can always update feisty meow, including this specific @@ -38,7 +40,6 @@ rm -f "$TMPO_CHK" exit_on_error "removing file: $TMPO_CHK" echo "getting repositories at: $(date)" -echo # perform the checkouts as appropriate per OS. FULL_LIST="$(dirname $FEISTY_MEOW_APEX) $HOME" @@ -48,6 +49,8 @@ fi checkout_list $FULL_LIST 2>&1 | tee -a "$TMPO_CHK" exit_on_error "checking out list: $FULL_LIST" +echo + ############## # regenerate the scripts after getting latest version of feisty meow. @@ -55,3 +58,5 @@ regenerate ############## +restore_terminal_title + diff --git a/scripts/rev_control/git_info.sh b/scripts/rev_control/git_info.sh index 11817c70..c5eb747f 100644 --- a/scripts/rev_control/git_info.sh +++ b/scripts/rev_control/git_info.sh @@ -6,6 +6,12 @@ # license: MIT # # Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496 + +# mods made to save and restore terminal title by fred for feisty meow codebase. + +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" + +save_terminal_title pushd . >/dev/null @@ -38,3 +44,6 @@ echo "not a git repository." fi popd >/dev/null + +restore_terminal_title + diff --git a/scripts/rev_control/git_scruncher.sh b/scripts/rev_control/git_scruncher.sh index 76ca12de..e541da45 100644 --- a/scripts/rev_control/git_scruncher.sh +++ b/scripts/rev_control/git_scruncher.sh @@ -1,5 +1,9 @@ #!/bin/bash +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" + +save_terminal_title + # check for whether we see a .git folder. if [ ! -d ".git" ]; then echo This script needs to run in the directory where a git repository lives, @@ -12,4 +16,4 @@ git config --global pack.windowMemory "100m" git config --global pack.SizeLimit "100m" git config --global pack.threads "1" - +restore_terminal_title diff --git a/scripts/rev_control/puffer.sh b/scripts/rev_control/puffer.sh index bcadafc1..59ea7de5 100644 --- a/scripts/rev_control/puffer.sh +++ b/scripts/rev_control/puffer.sh @@ -9,6 +9,8 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" +save_terminal_title + ############## echo "puffing out repositories at: $(date)" @@ -29,3 +31,4 @@ regenerate ############## +restore_terminal_title diff --git a/scripts/rev_control/push_repo_downstream.sh b/scripts/rev_control/push_repo_downstream.sh index 281cc7e9..50f8d80a 100644 --- a/scripts/rev_control/push_repo_downstream.sh +++ b/scripts/rev_control/push_repo_downstream.sh @@ -33,6 +33,8 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" +save_terminal_title + # turn off occasionally troublesome setting before checkin. unset GIT_SSH @@ -48,7 +50,7 @@ exit_on_error "changing to directory: $dir" tempfile=$(generate_rev_ctrl_filelist) exit_on_error "generating revision control file list" -perform_revctrl_action_on_file "$tempfile" do_careful_git_update +perform_revctrl_action_on_file "$tempfile" do_revctrl_careful_update exit_on_error "doing a careful update on: $tempfile" # seems to be needed to cause a merge to be resolved. @@ -62,3 +64,4 @@ exit_on_error "running the git push downstream master" popd &>/dev/null +restore_terminal_title diff --git a/scripts/rev_control/rcheckin.sh b/scripts/rev_control/rcheckin.sh index 268bed81..dc05cf47 100644 --- a/scripts/rev_control/rcheckin.sh +++ b/scripts/rev_control/rcheckin.sh @@ -7,6 +7,8 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" +save_terminal_title + ############## dir="$1"; shift @@ -20,6 +22,7 @@ tempfile=$(generate_rev_ctrl_filelist) exit_on_error "generating revision control file list" popd &>/dev/null -perform_revctrl_action_on_file "$tempfile" do_checkin +perform_revctrl_action_on_file "$tempfile" do_revctrl_checkin exit_on_error "doing a check-in on: $tempfile" +restore_terminal_title diff --git a/scripts/rev_control/report_new.sh b/scripts/rev_control/report_new.sh index c2f3a032..5a057b0b 100644 --- a/scripts/rev_control/report_new.sh +++ b/scripts/rev_control/report_new.sh @@ -8,6 +8,8 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" +save_terminal_title + ############## dir="$1"; shift @@ -21,6 +23,8 @@ tempfile=$(generate_rev_ctrl_filelist) exit_on_error "generating revision control file list" popd &>/dev/null -perform_revctrl_action_on_file "$tempfile" do_report_new +perform_revctrl_action_on_file "$tempfile" do_revctrl_report_new exit_on_error "running revision control report" +restore_terminal_title + diff --git a/scripts/rev_control/resolve_svn.sh b/scripts/rev_control/resolve_svn.sh index e1d4913a..15acfd4a 100644 --- a/scripts/rev_control/resolve_svn.sh +++ b/scripts/rev_control/resolve_svn.sh @@ -6,6 +6,8 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" +save_terminal_title + ############## filename="$1"; shift @@ -18,4 +20,5 @@ fi svn resolve --accept=working "$filename" exit_on_error "resolving tree conflict by accepting the working directory as the right one" +restore_terminal_title diff --git a/scripts/rev_control/rgetem.sh b/scripts/rev_control/rgetem.sh index eeb86f70..529fae19 100644 --- a/scripts/rev_control/rgetem.sh +++ b/scripts/rev_control/rgetem.sh @@ -7,6 +7,8 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" +save_terminal_title + ############## dir="$1"; shift @@ -20,6 +22,8 @@ tempfile=$(generate_rev_ctrl_filelist) exit_on_error "generating revision control file list" popd &>/dev/null -perform_revctrl_action_on_file "$tempfile" do_update +perform_revctrl_action_on_file "$tempfile" do_revctrl_simple_update exit_on_error "running revision control update" +restore_terminal_title + diff --git a/scripts/rev_control/rpuffer.sh b/scripts/rev_control/rpuffer.sh index 0cb0345c..ddf16337 100644 --- a/scripts/rev_control/rpuffer.sh +++ b/scripts/rev_control/rpuffer.sh @@ -11,6 +11,8 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" +save_terminal_title + ############## dir="$1"; shift @@ -24,6 +26,8 @@ tempfile=$(generate_rev_ctrl_filelist) exit_on_error "generating revision control file list" popd &>/dev/null -perform_revctrl_action_on_file "$tempfile" do_careful_git_update +perform_revctrl_action_on_file "$tempfile" do_revctrl_careful_update exit_on_error "puffing out repository at: $tempfile" +restore_terminal_title + diff --git a/scripts/rev_control/svnapply.sh b/scripts/rev_control/svnapply.sh index 32ce85aa..2c4d2f07 100644 --- a/scripts/rev_control/svnapply.sh +++ b/scripts/rev_control/svnapply.sh @@ -15,6 +15,10 @@ # http://stackoverflow.com/questions/160104/how-do-you-add-all-untracked-files-in-svn-something-like-git-add-i # +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" + +save_terminal_title + PATTERN="$1"; shift svn st | egrep "^\\${PATTERN}[ ]+" | \ @@ -22,3 +26,5 @@ svn st | egrep "^\\${PATTERN}[ ]+" | \ sed -e "s|\\\\|/|g" | \ xargs -i "$@" '{}' +restore_terminal_title + diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index f017a1e0..4e53a513 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -76,12 +76,10 @@ fi ############## # checks the directory provided into the revision control system repository it belongs to. -function do_checkin() +function do_revctrl_checkin() { local directory="$1"; shift - save_terminal_title - # make a nice echoer since we want to use it inside conditions below. local nicedir="$directory" if [ $nicedir == "." ]; then @@ -91,10 +89,10 @@ function do_checkin() #hmmm: we don't do a puff out on this directory to carefully update the git repo. is there a good reason why? # we know we at least have to get the remote version synched up to avoid severe tire damage, so it's sensible at -# least to call do_update, but is there a reason not to call the careful git update instead? -#AHA, below we do call a careful git update, which is at least partially redundant with calling do_update here. -# how about pushing the do_update down into the two cases that use it and just not calling it for the git case? - do_update "$directory" +# least to call do_revctrl_simple_update, but is there a reason not to call the careful git update instead? +#AHA, below we do call a careful git update, which is at least partially redundant with calling do_revctrl_simple_update here. +# how about pushing the do_revctrl_simple_update down into the two cases that use it and just not calling it for the git case? + do_revctrl_simple_update "$directory" exit_on_error "updating repository; this issue should be fixed before check-in." pushd "$directory" &>/dev/null @@ -142,7 +140,7 @@ function do_checkin() fi # a new set of steps we have to take to make sure the branch integrity is good. - do_careful_git_update "$(\pwd)" + do_revctrl_careful_update "$(\pwd)" # we continue on to the push, even if there were no changes this time, because # there could already be committed changes that haven't been pushed yet. @@ -159,18 +157,14 @@ function do_checkin() fi popd &>/dev/null - restore_terminal_title - return 0 } # shows the local changes in a repository. -function do_diff +function do_revctrl_diff { local directory="$1"; shift - save_terminal_title - pushd "$directory" &>/dev/null # only update if we see a repository living there. @@ -187,18 +181,14 @@ function do_diff popd &>/dev/null - restore_terminal_title - return 0 } # reports any files that are not already known to the upstream repository. -function do_report_new +function do_revctrl_report_new { local directory="$1"; shift - save_terminal_title - pushd "$directory" &>/dev/null # only update if we see a repository living there. @@ -215,8 +205,6 @@ function do_report_new popd &>/dev/null - restore_terminal_title - return 0 } @@ -226,8 +214,6 @@ function checkin_list() # make the list of directories unique. local list="$(uniquify $*)" - save_terminal_title - # turn repo list back into an array. eval "repository_list=( ${REPOSITORY_LIST[*]} )" @@ -238,22 +224,18 @@ function checkin_list() if [[ $outer =~ /.* ]]; then # yep, this path is absolute. just handle it directly. if [ ! -d "$outer" ]; then continue; fi - do_checkin "$outer" + do_revctrl_checkin "$outer" exit_on_error "running check-in (absolute) on path: $outer" -# sep 28 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 - do_checkin "$path" + do_revctrl_checkin "$path" exit_on_error "running check-in (relative) on path: $path" -# sep 28 done fi done - - restore_terminal_title } #hmmm: below functions are git specific and should be named that way. @@ -329,7 +311,7 @@ function show_branch_conditionally() # the git update process just gets more and more complex when you bring in # branches, so we've moved this here to avoid having a ton of code in the # other methods. -function do_careful_git_update() +function do_revctrl_careful_update() { local directory="$1"; shift pushd "$directory" &>/dev/null @@ -338,8 +320,8 @@ function do_careful_git_update() if [ ! -d ".git" ]; then # not a git project, so just boil this down to a getem action. popd &>/dev/null -echo "special case; not doing careful git update on non git repository: $directory" - do_update "$directory" + log_feisty_meow_event "skipping careful part and doing simple update on non-git repository: $directory" + do_revctrl_simple_update "$directory" return $? fi @@ -349,7 +331,7 @@ echo "special case; not doing careful git update on non git repository: $directo if [ $nicedir == "." ]; then nicedir=$(\pwd) fi - local blatt="echo -e \nretrieving '$nicedir'..." + local blatt="echo -e \ncarefully retrieving '$nicedir'..." $blatt local this_branch="$(my_branch_name)" @@ -404,12 +386,10 @@ echo "special case; not doing careful git update on non git repository: $directo } # gets the latest versions of the assets from the upstream repository. -function do_update() +function do_revctrl_simple_update() { directory="$1"; shift - save_terminal_title - # make a nice echoer since we want to use it inside conditions below. local nicedir="$directory" if [ $nicedir == "." ]; then @@ -446,8 +426,6 @@ function do_update() fi popd &>/dev/null - restore_terminal_title - return 0 } @@ -456,8 +434,6 @@ function checkout_list() { local list="$(uniquify $*)" - save_terminal_title - # turn repo list back into an array. eval "repository_list=( ${REPOSITORY_LIST[*]} )" @@ -468,22 +444,18 @@ function checkout_list() if [[ $outer =~ /.* ]]; then # yep, this path is absolute. just handle it directly. if [ ! -d "$outer" ]; then continue; fi - do_update $outer + do_revctrl_simple_update $outer exit_on_error "running update on: $path" -# sep 28 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 - do_update $path + do_revctrl_simple_update $path exit_on_error "running update on: $path" -# sep 28 done fi done - - restore_terminal_title } # does a careful update on all the folders in the specified list; @@ -495,8 +467,6 @@ function puff_out_list() # make the list of directories unique. local list="$(uniquify $*)" - save_terminal_title - # turn repo list back into an array. eval "repository_list=( ${REPOSITORY_LIST[*]} )" @@ -508,22 +478,18 @@ function puff_out_list() if [[ $outer =~ /.* ]]; then # yep, this path is absolute. just handle it directly. if [ ! -d "$outer" ]; then continue; fi - do_careful_git_update "$outer" + do_revctrl_careful_update "$outer" exit_on_error "running puff-out (absolute) on path: $outer" -# sep 28 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 - do_careful_git_update "$path" + do_revctrl_careful_update "$path" exit_on_error "running puff-out (relative) on path: $path" -# sep 28 done fi done - - restore_terminal_title } # provides a list of absolute paths of revision control directories @@ -559,8 +525,6 @@ function perform_revctrl_action_on_file() local tempfile="$1"; shift local action="$1"; shift - save_terminal_title - local did_anything= while read -u 3 dirname; do @@ -574,7 +538,6 @@ function perform_revctrl_action_on_file() # pass the current directory plus the remaining parameters from function invocation. $action . exit_on_error "performing action $action on: $(pwd)" -# sep 28 popd &>/dev/null done 3<"$tempfile" @@ -582,8 +545,6 @@ function perform_revctrl_action_on_file() echo "There was nothing to do the action '$action' on." fi - restore_terminal_title - rm "$tempfile" } diff --git a/scripts/text/diff_lib.pl b/scripts/text/diff_lib.pl index c34a5be7..158f205c 100644 --- a/scripts/text/diff_lib.pl +++ b/scripts/text/diff_lib.pl @@ -119,7 +119,7 @@ sub diff_dirs { @name_components = split(/\//, $filename); $basename = $name_components[$#name_components]; # print "doing diff of $filename against $compare_directory/$basename\n"; - &do_diff($filename, $compare_directory."/".$basename); + &compute_file_differences($filename, $compare_directory."/".$basename); } closedir CURDIR; @@ -222,7 +222,7 @@ sub change_to_saw_same { # checks the differences between the two files and creates appropriate output. -sub do_diff { +sub compute_file_differences { local($first, $second) = @_; # turn stupid pc slashes into normal ones.