--- /dev/null
+#!/bin/bash
+
+# puffer: "puffs out" all of the folders present in the REPOSITORY_LIST
+# variable, which causes the repo to be merged with its remote versions.
+# this enables a clean check-in; after puffer runs, there will be no secret
+# upstream changes that could mess up the git push (svn and cvs are not
+# supported in this script, since they branch differently than git).
+
+source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
+source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh"
+
+##############
+
+echo "puffing out repositories at: $(date)"
+echo
+
+FULL_LIST=" $(dirname $FEISTY_MEOW_APEX) $HOME "
+if [ "$OS" == "Windows_NT" ]; then
+ FULL_LIST+=" c:/ d:/ e:/ "
+fi
+
+puff_out_list $FULL_LIST
+test_or_die "puffing out list: $FULL_LIST"
+
+##############
+
+# regenerate the scripts after puffing out, since this could mean a modified version
+# of feisty meow is present.
+regenerate
+
+##############
+
# see if there are any changes in the local repository.
if ! git diff-index --quiet HEAD --; then
# tell git about all the files and get a check-in comment.
+#hmmm: begins to look like, you guessed it, a reusable bit that all commit actions could enjoy.
git commit .
- test_or_die "git commit"
+ retval=$?
+ test_or_continue "git commit"
+ if [ $retval -ne 0 ]; then
+ echo -e -n "Commit failed or was aborted:\nShould we continue with other check-ins? [y/N] "
+ local line
+ read line
+ if [[ "${line:0:1}" != "y" ]]; then
+ echo "Stopping check-in process due to missing commit and user request."
+ exit 1
+ fi
+ fi
fi
# a new set of steps we have to take to make sure the branch integrity is good.
return 0
}
-# checks in all the folders in a specified list.
+# checks in all the folders in the specified list.
function checkin_list()
{
# make the list of directories unique.
if [[ $outer =~ /.* ]]; then
# yep, this path is absolute. just handle it directly.
if [ ! -d "$outer" ]; then continue; fi
- do_checkin $outer
+ do_checkin "$outer"
test_or_die "running check-in (absolute) on path: $outer"
sep 28
else
# 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_checkin "$path"
test_or_die "running check-in (relative) on path: $path"
sep 28
done
restore_terminal_title
}
-# takes out the first few carriage returns that are in the input.
-function squash_first_few_crs()
+# does a careful git update on all the folders in the specified list.
+function puff_out_list()
{
- i=0
- while read input_text; do
- i=$((i+1))
- if [ $i -le 5 ]; then
- echo -n "$input_text "
+ # make the list of directories unique.
+ local list="$(uniquify $*)"
+
+ save_terminal_title
+
+ # turn repo list back into an array.
+ eval "repository_list=( ${REPOSITORY_LIST[*]} )"
+
+ local outer inner
+
+#hmmm: once again, seeing some reusable code in this loop...
+ 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
+ do_careful_git_update "$outer"
+ test_or_die "running puff-out (absolute) on path: $outer"
+ sep 28
else
- echo $input_text
+ 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"
+ test_or_die "running puff-out (relative) on path: $path"
+ sep 28
+ done
fi
done
- if [ $i -le 3 ]; then
- # if we're still squashing eols, make sure we don't leave them hanging.
- echo
- fi
+
+ restore_terminal_title
}
+#hmmm: to go below.
+### takes out the first few carriage returns that are in the input.
+##function squash_first_few_crs()
+##{
+ ##i=0
+ ##while read input_text; do
+ ##i=$((i+1))
+ ##if [ $i -le 5 ]; then
+ ##echo -n "$input_text "
+ ##else
+ ##echo $input_text
+ ##fi
+ ##done
+ ##if [ $i -le 3 ]; then
+ ### if we're still squashing eols, make sure we don't leave them hanging.
+ ##echo
+ ##fi
+##}
+
#hmmm: the below are git specific and should be named that way.
function all_branch_names()
local remote_branch=$(git rev-parse "$branch")
local merge_base=$(git merge-base @ "$branch")
+ local to_echo=
if [ "$local_branch" == "$remote_branch" ]; then
- echo "okay"
+ to_echo="okay"
elif [ "$local_branch" == "$merge_base" ]; then
- echo "needs_pull"
+ to_echo="needs_pull"
elif [ "$remote_branch" == "$merge_base" ]; then
- echo "needs_push"
+ to_echo="needs_push"
else
- echo "diverged"
+ to_echo="diverged"
fi
+ echo -n "$to_echo"
+
return $to_return
}
{
local this_branch="$1"; shift
- state=$(check_branch_state "$this_branch")
+ local state=$(check_branch_state "$this_branch")
if [ "$state" != "okay" ]; then
echo "=> branch '$this_branch' state is not clean: $state"
fi
# we are pretty sure the remote branch does exist.
git pull --no-ff origin "$bran" | $TO_SPLITTER
promote_pipe_return 0
-
- echo "=> branch '$bran' state after pull is: $state"
fi
test_or_die "git pull of remote branch: $bran"
done