From: Chris Koeritz Date: Thu, 9 Nov 2017 17:25:44 +0000 (-0500) Subject: more refactoring of revision control scripts X-Git-Tag: 2.140.90~22 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=2ab1cf327d1637a4660147eabc7f32bbe0039b7d;p=feisty_meow.git more refactoring of revision control scripts hopefully the last checkin --- diff --git a/scripts/rev_control/compact_git.sh b/scripts/rev_control/compact_git.sh index 8de72543..c1a22ef0 100644 --- a/scripts/rev_control/compact_git.sh +++ b/scripts/rev_control/compact_git.sh @@ -2,16 +2,28 @@ # compresses the git archive in the folder specified. +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" + +############## + prune_dir="$1" if [ -z "$prune_dir" ]; then prune_dir="$(pwd)" fi -pushd "$prune_dir" +pushd "$prune_dir" &>/dev/null +test_or_die "changing to directory: $prune_dir" + echo "cleaning git repo in directory $(pwd)" + git fsck --full test_or_die "git fsck" + git gc --prune=today --aggressive test_or_die "git gc" + git repack test_or_die "git repack" -popd + +popd &>/dev/null + diff --git a/scripts/rev_control/getem.sh b/scripts/rev_control/getem.sh index 3818b588..e7aeabc6 100644 --- a/scripts/rev_control/getem.sh +++ b/scripts/rev_control/getem.sh @@ -7,11 +7,12 @@ source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" ############## -# trickery to ensure we can always update this file, even when the operating system has some -# rude behavior with regard to file locking (ahem, windows...). -# and even more rudeness is that the pwd and $TMP may not always be in the same form, -# which causes endless confusion and badness. that's why we get the pwd reading for TMP -# first so we can do an orange-to-orange compare. +# trickery to ensure we can always update feisty meow, including this specific +# file, even when the operating system has some rude behavior with regard to +# file locking (ahem, windoze). and even more rudeness is that the pwd and +# $TMP may not always be in the same form, which causes endless confusion and +# badness. that's why we get the pwd reading for TMP first so we can do an +# oranges-to-oranges compare. tmpdir="$(cd $TMP; \pwd)" if [ "$(\pwd)" != "$tmpdir" ]; then if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then @@ -20,11 +21,13 @@ if [ "$(\pwd)" != "$tmpdir" ]; then new_name="$TMP/zz_$(basename $0)" \cp -f "$0" "$new_name" test_or_die "failed to copy this script up to the TMP directory. exploit attempted?" - cd "$TMP" + pushd "$TMP" &>/dev/null + test_or_die "changing to TMP directory: $TMP" chmod a+x "$new_name" test_or_die "chmodding of file: $new_name" exec "$new_name" test_or_die "execing cloned getemscript" + popd &>/dev/null fi ############## diff --git a/scripts/rev_control/push_repo_downstream.sh b/scripts/rev_control/push_repo_downstream.sh index 2f4e3db1..84214b70 100644 --- a/scripts/rev_control/push_repo_downstream.sh +++ b/scripts/rev_control/push_repo_downstream.sh @@ -30,14 +30,18 @@ # # push_repo_downstream ~/relay_repo_folder -#hmmm: make this support multiple dirs? +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" + +############## dir="$1"; shift if [ -z "$dir" ]; then dir=. fi -pushd "$dir" +pushd "$dir" &>/dev/null +test_or_die "changing to directory: $dir" # get everything from the origin. git fetch origin @@ -50,6 +54,5 @@ unset GIT_SSH git push downstream master test_or_die "running the git push downstream" -popd - +popd &>/dev/null diff --git a/scripts/rev_control/rcheckin.sh b/scripts/rev_control/rcheckin.sh index 1c50d517..1c5400fb 100644 --- a/scripts/rev_control/rcheckin.sh +++ b/scripts/rev_control/rcheckin.sh @@ -14,10 +14,10 @@ if [ -z "$dir" ]; then dir=. fi - pushd "$dir" &>/dev/null test_or_die "changing to directory: $dir" tempfile=$(generate_rev_ctrl_filelist) +test_or_die "generating revision control file list" 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 index 4da1a4a0..e51e90c7 100644 --- a/scripts/rev_control/report_new.sh +++ b/scripts/rev_control/report_new.sh @@ -18,6 +18,7 @@ fi pushd "$dir" &>/dev/null test_or_die "changing directory to: $dir" tempfile=$(generate_rev_ctrl_filelist) +test_or_die "generating revision control file list" 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 index 3484a859..b7597973 100644 --- a/scripts/rev_control/resolve_svn.sh +++ b/scripts/rev_control/resolve_svn.sh @@ -3,8 +3,18 @@ # resolves a tree conflict by accepting the "working" version, # which effectively makes your current change the accepted one. +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh" + +############## + filename="$1"; shift +if [ -z "$filename" ]; then + echo "This script needs a filename to operate on." + exit 1 +fi + svn resolve --accept=working "$filename" test_or_die "resolving tree conflict by accepting the working directory as the right one" diff --git a/scripts/rev_control/rgetem.sh b/scripts/rev_control/rgetem.sh index 37538b6b..4c29c038 100644 --- a/scripts/rev_control/rgetem.sh +++ b/scripts/rev_control/rgetem.sh @@ -17,6 +17,7 @@ fi pushd "$dir" &>/dev/null test_or_die "changing to directory: $dir" tempfile=$(generate_rev_ctrl_filelist) +test_or_die "generating revision control file list" popd &>/dev/null perform_revctrl_action_on_file "$tempfile" do_update