From: Chris Koeritz Date: Fri, 3 Nov 2017 05:19:14 +0000 (-0400) Subject: cleaning up revision control tools X-Git-Tag: 2.140.90~106 X-Git-Url: https://feistymeow.org/gitweb/?p=feisty_meow.git;a=commitdiff_plain;h=ba3dab0632f2eedfce6f724d76a9c967ccb9fe90 cleaning up revision control tools tried to move to a consistent naming scheme. getem and checkin are the "grab the code" and "check the code in" operations. so rgetem and rcheckin are the recursive versions of those that act on a whole hierarchy. other scripts have been renamed for easier understanding of what the heck they do. some junk scripts have been flushed out. --- diff --git a/infobase/configuration/cron/synch_and_swim_downstream.crontab b/infobase/configuration/cron/synch_and_swim_downstream.crontab index 0d783169..c7d9c507 100644 --- a/infobase/configuration/cron/synch_and_swim_downstream.crontab +++ b/infobase/configuration/cron/synch_and_swim_downstream.crontab @@ -4,5 +4,5 @@ # repositories, such as sourceforge or github. the uploading process (which we think of as sending # those updated items swimming downstream to their dependent repositories) is done automatically in # our makefiles. that's why the code below relies on the top-level makefile in home. -14 3 * * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; cd $HOME ; bash $FEISTY_MEOW_SCRIPTS/rev_control/rev_update.sh ; make ) &>>/tmp/${CRONUSER}-cron-synch_and_swim_downstream.log +14 3 * * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; cd $HOME ; bash $FEISTY_MEOW_SCRIPTS/rev_control/rgetem.sh ; make ) &>>/tmp/${CRONUSER}-cron-synch_and_swim_downstream.log diff --git a/scripts/archival/shared_updater_parts.sh b/scripts/archival/shared_updater_parts.sh index 13518e95..77c2c939 100644 --- a/scripts/archival/shared_updater_parts.sh +++ b/scripts/archival/shared_updater_parts.sh @@ -17,7 +17,7 @@ function update_source_folders() echo Changing to the folder $folder failed. exit 1 fi - bash "$FEISTY_MEOW_SCRIPTS/rev_control/rev_checkin.sh" + bash "$FEISTY_MEOW_SCRIPTS/rev_control/rcheckin.sh" if [ $? -ne 0 ]; then echo Checking out the latest codes has failed somehow for $folder. exit 1 diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 6572a486..6f02ae26 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -347,7 +347,7 @@ if [ -z "$skip_all" ]; then # fi } - # trashes the .#blah files that cvs and svn leave behind when finding conflicts. + # trashes the .#blah files that cvs and subversion leave behind when finding conflicts. # this kind of assumes you've already checked them for any salient facts. function clean_cvs_junk() { for i in $*; do diff --git a/scripts/files/cleanerator.sh b/scripts/files/cleanerator.sh deleted file mode 100644 index 1d1e138c..00000000 --- a/scripts/files/cleanerator.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -cleaning_dirs=($*) - -more_authoritative=( ~/feisty_meow ~/scavenging_inova/inovasoft ) -###not yet ~/scavenging_inova/lightlink - -if [ -z "$TMP" ]; then TMP=/tmp; fi - -# we generate the full directory list for the authoritative places into here. -zesty_authoritative_dirs=$(mktemp $TMP/cleanerator_authority.XXXXXX) -# we also make a list of all the directories under our cleaning locations here. -perky_scrubbing_dirs=$(mktemp $TMP/cleanerator_scrubbinz.XXXXXX) - -# dump out the directories found in the authoritative areas. -for i in "${more_authoritative[@]}"; do - real_dir="$(\cd "$i" && \pwd)" - find "$real_dir" -type d | grep -v "\.svn" | grep -v "\.git" >>"$zesty_authoritative_dirs" -done - -# now go to all of our places to clean, find all directories under them, -# and add them to our big list of places to scrub. -for i in "${cleaning_dirs[@]}"; do - real_dir="$(\cd "$i" && \pwd)" - find "$real_dir" -depth -type d | grep -v "\.svn" | grep -v "\.git" >>"$perky_scrubbing_dirs" -done - -# load all the names from our files and do a massive N x M size loop. -while read i; do -# echo "cleaning: $i" - pushd "$i" &>/dev/null -#pwd - while read j; do -# echo "against authority: $j" - # try to clean it out of source control first. - bash ~/feisty_meow/scripts/rev_control/svn_rm_dupes.sh "$j" "$i" - # if that doesn't work, just whack it. - bash ~/feisty_meow/scripts/files/whack_dupes.sh "$j" "$i" - done <"$zesty_authoritative_dirs" - popd &>/dev/null -done <"$perky_scrubbing_dirs" - -# clean up afterwards. -rm -f "$zesty_authoritative_dirs" -rm -f "$perky_scrubbing_dirs" - diff --git a/scripts/rev_control/diff_repo.sh b/scripts/rev_control/diff_repo.sh new file mode 100644 index 00000000..d74905c3 --- /dev/null +++ b/scripts/rev_control/diff_repo.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# does differences on a set of folders checked out from subversion or git. +# this can take a directory as parameter, but will default to the current +# working directory. all the directories under the passed directory will +# be examined. + +dir="$1"; shift +if [ -z "$dir" ]; then + dir=. +fi + +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" + +pushd "$dir" &>/dev/null +tempfile=$(generate_rev_ctrl_filelist) +popd &>/dev/null + +perform_revctrl_action_on_file "$tempfile" do_diff + diff --git a/scripts/rev_control/fix_ssh_perms.sh b/scripts/rev_control/fix_ssh_perms.sh deleted file mode 100644 index eb294fc8..00000000 --- a/scripts/rev_control/fix_ssh_perms.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# resets the permissions on the .ssh directory to be safe. -# otherwise ssh may ignore keys and such from there. - -chmod 700 $HOME/.ssh -chmod 600 $HOME/.ssh/* - - diff --git a/scripts/rev_control/fix_svn_item.sh b/scripts/rev_control/fix_svn_item.sh deleted file mode 100644 index 941e5729..00000000 --- a/scripts/rev_control/fix_svn_item.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# resolves a tree conflict by accepting the "working" version, -# which effectively makes your current change the accepted one. - -filename="$1"; shift - -svn resolve --accept=working "$filename" - - diff --git a/scripts/rev_control/rcheckin.sh b/scripts/rev_control/rcheckin.sh new file mode 100644 index 00000000..cfb72c29 --- /dev/null +++ b/scripts/rev_control/rcheckin.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# checks in the updated files in a set of folders checked out from subversion +# or git. this can take a directory as parameter, but will default to the +# current working directory. all the directories under the passed directory +# will be examined. + +dir="$1"; shift +if [ -z "$dir" ]; then + dir=. +fi + +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" + +pushd "$dir" &>/dev/null +tempfile=$(generate_rev_ctrl_filelist) +popd &>/dev/null + +perform_revctrl_action_on_file "$tempfile" do_checkin + diff --git a/scripts/rev_control/report_new.sh b/scripts/rev_control/report_new.sh new file mode 100644 index 00000000..224b1dfb --- /dev/null +++ b/scripts/rev_control/report_new.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# this script reports files that are not checked in yet in a set of folders. +# it works with subversion only, since git handles new files well whereas +# subversion ignores them until you tell it about them. this script can take +# a directory as a parameter, but will default to the current directory. +# all the directories under the passed directory will be examined. + +dir="$1"; shift +if [ -z "$dir" ]; then + dir=. +fi + +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" + +pushd "$dir" &>/dev/null +tempfile=$(generate_rev_ctrl_filelist) +popd &>/dev/null + +perform_revctrl_action_on_file "$tempfile" do_report_new + diff --git a/scripts/rev_control/resolve_svn.sh b/scripts/rev_control/resolve_svn.sh new file mode 100644 index 00000000..941e5729 --- /dev/null +++ b/scripts/rev_control/resolve_svn.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# resolves a tree conflict by accepting the "working" version, +# which effectively makes your current change the accepted one. + +filename="$1"; shift + +svn resolve --accept=working "$filename" + + diff --git a/scripts/rev_control/rev_checkin.sh b/scripts/rev_control/rev_checkin.sh deleted file mode 100644 index cfb72c29..00000000 --- a/scripts/rev_control/rev_checkin.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# checks in the updated files in a set of folders checked out from subversion -# or git. this can take a directory as parameter, but will default to the -# current working directory. all the directories under the passed directory -# will be examined. - -dir="$1"; shift -if [ -z "$dir" ]; then - dir=. -fi - -source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" -source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" - -pushd "$dir" &>/dev/null -tempfile=$(generate_rev_ctrl_filelist) -popd &>/dev/null - -perform_revctrl_action_on_file "$tempfile" do_checkin - diff --git a/scripts/rev_control/rev_diff.sh b/scripts/rev_control/rev_diff.sh deleted file mode 100644 index d74905c3..00000000 --- a/scripts/rev_control/rev_diff.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# does differences on a set of folders checked out from subversion or git. -# this can take a directory as parameter, but will default to the current -# working directory. all the directories under the passed directory will -# be examined. - -dir="$1"; shift -if [ -z "$dir" ]; then - dir=. -fi - -source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" -source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" - -pushd "$dir" &>/dev/null -tempfile=$(generate_rev_ctrl_filelist) -popd &>/dev/null - -perform_revctrl_action_on_file "$tempfile" do_diff - diff --git a/scripts/rev_control/rev_report_new.sh b/scripts/rev_control/rev_report_new.sh deleted file mode 100644 index 224b1dfb..00000000 --- a/scripts/rev_control/rev_report_new.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# this script reports files that are not checked in yet in a set of folders. -# it works with subversion only, since git handles new files well whereas -# subversion ignores them until you tell it about them. this script can take -# a directory as a parameter, but will default to the current directory. -# all the directories under the passed directory will be examined. - -dir="$1"; shift -if [ -z "$dir" ]; then - dir=. -fi - -source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" -source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" - -pushd "$dir" &>/dev/null -tempfile=$(generate_rev_ctrl_filelist) -popd &>/dev/null - -perform_revctrl_action_on_file "$tempfile" do_report_new - diff --git a/scripts/rev_control/rev_update.sh b/scripts/rev_control/rev_update.sh deleted file mode 100644 index 6e096279..00000000 --- a/scripts/rev_control/rev_update.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# a simple script for updating a set of folders from subversion or git. -# this can take a directory as parameter, but will default to the current -# working directory. all the directories under the passed directory will -# be examined. - -dir="$1"; shift -if [ -z "$dir" ]; then - dir=. -fi - -source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" -source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" - -pushd "$dir" &>/dev/null -tempfile=$(generate_rev_ctrl_filelist) -popd &>/dev/null - -perform_revctrl_action_on_file "$tempfile" do_update - diff --git a/scripts/rev_control/rgetem.sh b/scripts/rev_control/rgetem.sh new file mode 100644 index 00000000..6e096279 --- /dev/null +++ b/scripts/rev_control/rgetem.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# a simple script for updating a set of folders from subversion or git. +# this can take a directory as parameter, but will default to the current +# working directory. all the directories under the passed directory will +# be examined. + +dir="$1"; shift +if [ -z "$dir" ]; then + dir=. +fi + +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" + +pushd "$dir" &>/dev/null +tempfile=$(generate_rev_ctrl_filelist) +popd &>/dev/null + +perform_revctrl_action_on_file "$tempfile" do_update + diff --git a/scripts/rev_control/svn.sh b/scripts/rev_control/svn.sh deleted file mode 100644 index 63af6695..00000000 --- a/scripts/rev_control/svn.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -if [ "$OPERATING_SYSTEM" = "WIN32" ]; then - source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" - - TMP="$(dos_to_unix_path "$TMP")" -fi - -#echo TMP is $TMP - -/usr/bin/svn $@ - diff --git a/scripts/rev_control/svnapply.sh b/scripts/rev_control/svnapply.sh index c9db62e7..32ce85aa 100644 --- a/scripts/rev_control/svnapply.sh +++ b/scripts/rev_control/svnapply.sh @@ -1,12 +1,15 @@ #!/bin/bash # -# Applies arbitrary commands to any svn status. e.g. +# Applies arbitrary commands to any svn status. # -# Delete all non-svn files (escape the ? from the shell): -# svnapply \? rm +# For example, this shows any files that are in the working folder but are not part of the svn repository: +# svnapply \? echo +# +# This deletes all files that are not checked into svn (escape the ? from the shell): +# svnapply \? rm # # List all conflicted files: -# svnapply C ls -l +# svnapply C ls -l # # found on web at: # http://stackoverflow.com/questions/160104/how-do-you-add-all-untracked-files-in-svn-something-like-git-add-i diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index 4a8a542d..b28d6f30 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -307,13 +307,13 @@ function generate_rev_ctrl_filelist() local dir="$1"; shift pushd "$dir" &>/dev/null local dirhere="$( \cd "$(\dirname "$dir")" && /bin/pwd )" - local tempfile=$(mktemp /tmp/zz_rev_checkin.XXXXXX) + local tempfile=$(mktemp /tmp/zz_checkins.XXXXXX) echo >$tempfile find $dirhere -follow -maxdepth $MAX_DEPTH -type d -iname ".svn" -exec echo {}/.. ';' >>$tempfile 2>/dev/null find $dirhere -follow -maxdepth $MAX_DEPTH -type d -iname ".git" -exec echo {}/.. ';' >>$tempfile 2>/dev/null # CVS is not well behaved like git and (now) svn, and we seldom use it anymore. popd &>/dev/null - local sortfile=$(mktemp /tmp/zz_rev_checkin_sort.XXXXXX) + local sortfile=$(mktemp /tmp/zz_checkin_sort.XXXXXX) sort <"$tempfile" >"$sortfile" \rm "$tempfile" echo "$sortfile" diff --git a/scripts/security/fix_ssh_perms.sh b/scripts/security/fix_ssh_perms.sh new file mode 100644 index 00000000..eb294fc8 --- /dev/null +++ b/scripts/security/fix_ssh_perms.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# resets the permissions on the .ssh directory to be safe. +# otherwise ssh may ignore keys and such from there. + +chmod 700 $HOME/.ssh +chmod 600 $HOME/.ssh/* + +