to version_control to avoid name completion annoyance. made more scripts rely on the
version control library to avoid code duplication. cleanup is next.
# checks in all the folders present in the REPOSITORY_LIST variable.
source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
-source "$FEISTY_MEOW_SCRIPTS/rev_control/rev_control.sh"
-
-# selects the method for check-in based on where we are.
-function do_checkin()
-{
- local directory="$1"; shift
- if [ -d "CVS" ]; then cvs ci . ;
- elif [ -d ".svn" ]; then svn ci . ;
- elif [ -d ".git" ]; then
- # snag all new files. not to everyone's liking.
- git add .
- # tell git about all the files and get a check-in comment.
- git commit .
- # upload the files to the server so others can see them.
- git push 2>&1 | grep -v "X11 forwarding request failed"
- else
- echo unknown repository for $directory...
- fi
-}
-
-# checks in all the folders in a specified list.
-function checkin_list {
- local list=$*
- 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
-
- pushd $j &>/dev/null
- echo "checking in '$j'..."
- do_checkin $j
- popd &>/dev/null
- done
- done
-}
+source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh"
echo "Committing repositories at: $(date)"
# gets any updates for the repository folders present in the REPOSITORY_LIST variable.
source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
-source "$FEISTY_MEOW_SCRIPTS/rev_control/rev_control.sh"
+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...).
exec "$new_name"
fi
-# takes out the first few carriage returns that are in the input.
-function squash_first_few_crs()
-{
- i=0
- while read line; do
- i=$((i+1))
- if [ $i -le 3 ]; then
- echo -n "$line "
- else
- echo $line
- fi
- done
- if [ $i -le 3 ]; then
- # if we're still squashing eols, make sure we don't leave them hanging.
- echo
- fi
-}
-
-# selects the checkout method based on where we are (the host the script runs on).
-function do_update()
-{
- directory="$1"; shift
-
- if [ -d "CVS" ]; then
- cvs update . | squash_first_few_crs
- elif [ -d ".svn" ]; then
- svn update . | squash_first_few_crs
- elif [ -d ".git" ]; then
- git pull 2>&1 | grep -v "X11 forwarding request failed" | squash_first_few_crs
- else
- echo unknown repository for $directory...
- fi
-}
-
-# gets all the updates for a list of folders under revision control.
-function checkout_list {
- list=$*
- 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
-
- pushd $j &>/dev/null
- echo -n "retrieving '$j'... "
- do_update $j
- popd &>/dev/null
- done
- done
-}
-
##############
export TMPO_CHK=$TMP/zz_chk.log
+++ /dev/null
-#!/bin/bash
-
-# a simple script for updating a set of folders on a usb stick from subversion or git. currently
-# just runs with no parameters and expects to get all archives from wherever the files originally
-# came from.
-
-dir="$1"; shift
-if [ -z "$dir" ]; then
- dir=.
-fi
-
-pushd "$dir" &>/dev/null
-
-for i in * ; do
- if [ -d "$i" ]; then
- echo "[$i]"
- pushd $i &>/dev/null
- # only update if we see a repository living there.
- if [ -d ".svn" ]; then
- bash $FEISTY_MEOW_SCRIPTS/rev_control/svnapply.sh \? echo
- fi
- popd &>/dev/null
- echo "======="
- fi
-done
-
-popd &>/dev/null
--- /dev/null
+#!/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/rev_control/version_control.sh"
+
+pushd "$dir" &>/dev/null
+
+for i in * ; do
+ if [ -d "$i" ]; then
+ echo "[$i]"
+ do_checkin $i
+# pushd $i &>/dev/null
+# # only update if we see a repository living there.
+# if [ -d ".svn" ]; then
+# svn ci .
+# elif [ -d ".git" ]; then
+# git commit .
+# git push
+# elif [ -d "CVS" ]; then
+# cvs diff .
+# fi
+# popd &>/dev/null
+ echo "======="
+ fi
+done
+
+popd &>/dev/null
+
+
+++ /dev/null
-#!/bin/bash
-
-# these are helper functions for doing localized revision control.
-# this script should be sourced into other scripts that use it.
-
-# one unpleasantry to take care of first; cygwin barfs aggressively if the TMP directory
-# is a DOS path, but we need it to be a DOS path for our XSEDE testing, so that blows.
-# to get past this, TMP gets changed below to a hopefully generic and safe place.
-
-if [[ "$TMP" =~ .:.* ]]; then
- echo making weirdo temporary directory for DOS path.
- export TMP=/tmp/rev_control_$USER
-fi
-if [ ! -d "$TMP" ]; then
- mkdir $TMP
-fi
-if [ ! -d "$TMP" ]; then
- echo "Could not create the temporary directory TMP in: $TMP"
- echo "This script will not work properly without an existing TMP directory."
-fi
-
-this_host=
-# gets the machine's hostname and stores it in the variable "this_host".
-function get_our_hostname()
-{
- if [ "$OS" == "Windows_NT" ]; then
- this_host=$(hostname)
- elif [ ! -z "$(echo $MACHTYPE | grep apple)" ]; then
- this_host=$(hostname)
- elif [ ! -z "$(echo $MACHTYPE | grep suse)" ]; then
- this_host=$(hostname --long)
- else
- this_host=$(hostname)
- fi
- #echo "hostname is $this_host"
-}
-
-# this function sets a variable called "home_system" to "true" if the
-# machine is considered one of fred's home machines. if you are not
-# fred, you may want to change the machine choices.
-export home_system=
-function is_home_system()
-{
- # load up the name of the host.
- get_our_hostname
- # reset the variable that we'll be setting.
- home_system=
- if [[ $this_host == *.gruntose.blurgh ]]; then
- home_system=true
-#temp code
-elif [[ $this_host == buildy ]]; then
-home_system=true
-elif [[ $this_host == simmy ]]; then
-home_system=true
-#temp code
- fi
-}
-
-# we only want to totally personalize this script if the user is right.
-function check_user()
-{
- if [ "$USER" == "fred" ]; then
- export SVNUSER=fred_t_hamster@
- export EXTRA_PROTOCOL=+ssh
- else
- export SVNUSER=
- export EXTRA_PROTOCOL=
- fi
-}
-
-# calculates the right modifier for hostnames / repositories.
-modifier=
-function compute_modifier()
-{
- modifier=
- directory="$1"; shift
- in_or_out="$1"; shift
- check_user
- # some project specific overrides.
- if [[ "$directory" == hoople* ]]; then
- modifier="svn${EXTRA_PROTOCOL}://${SVNUSER}svn.code.sf.net/p/hoople2/svn/"
- fi
- if [[ "$directory" == yeti* ]]; then
- modifier="svn${EXTRA_PROTOCOL}://${SVNUSER}svn.code.sf.net/p/yeti/svn/"
- fi
- # see if we're on one of fred's home machines.
- is_home_system
- # special override to pick local servers when at home.
- if [ "$home_system" == "true" ]; then
- if [ "$in_or_out" == "out" ]; then
- # need the right home machine for modifier when checking out.
- modifier="svn://shaggy/"
- else
- # no modifier for checkin.
- modifier=
- fi
- fi
-}
-
--- /dev/null
+#!/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
+
+pushd "$dir" &>/dev/null
+
+for i in * ; do
+ if [ -d "$i" ]; then
+ echo "[$i]"
+ pushd $i &>/dev/null
+ # only update if we see a repository living there.
+ if [ -d ".svn" ]; then
+ svn diff .
+ elif [ -d ".git" ]; then
+ git diff
+ elif [ -d "CVS" ]; then
+ cvs diff .
+ fi
+ popd &>/dev/null
+ echo "======="
+ fi
+done
+
+popd &>/dev/null
+
+
--- /dev/null
+#!/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
+
+pushd "$dir" &>/dev/null
+
+for i in * ; do
+ if [ -d "$i" ]; then
+ echo "[$i]"
+ pushd $i &>/dev/null
+ # only update if we see a repository living there.
+ if [ -d ".svn" ]; then
+ bash $FEISTY_MEOW_SCRIPTS/rev_control/svnapply.sh \? echo
+ fi
+ popd &>/dev/null
+ echo "======="
+ fi
+done
+
+popd &>/dev/null
--- /dev/null
+#!/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/rev_control/version_control.sh"
+
+pushd "$dir" &>/dev/null
+
+for i in * ; do
+ if [ -d "$i" ]; then
+ echo "[$i]"
+ do_update "$i"
+# pushd $i &>/dev/null
+# # only update if we see a repository living there.
+# if [ -d ".svn" ]; then
+# svn update .
+# elif [ -d ".git" ]; then
+# git pull
+# elif [ -d "CVS" ]; then
+# cvs update .
+# fi
+# popd &>/dev/null
+ echo "======="
+ fi
+done
+
+popd &>/dev/null
+
+++ /dev/null
-#!/bin/bash
-
-# whacks the files in the current directory which are duplicates of the
-# files in the directory passed as a parameter.
-# if there is a second parameter, then it is used as the "current directory".
-
-exemplar_dir="$1"; shift
-whack_dir="$1"; shift
-
-#hmmm: much code here is shared with whack_dupes. get into a library.
-
-# make sure they gave us a good directory to start with.
-if [ -z "$exemplar_dir" ]; then
- echo "whack_dupes"
- echo "-----------"
- echo ""
- echo "This program needs at least one directory parameter. The files in the"
- echo "current directory will be removed if a file in the specified directory"
- echo "already exists. So... the current directory is the less important one"
- echo "and is presumed to have duplicates AND the directory given as parameter"
- echo "is considered important and has the best versions of the files."
- echo "If there is an optional second parameter, then that is used as the"
- echo "\"current\" directory where we start from; it will be the less important"
- echo "directory and will have its entries cleaned if they're duplicates."
- exit 42;
-fi
-
-# check to make sure they gave us a good directory.
-if [ ! -z "$whack_dir" -a ! -d "$whack_dir" ]; then
- echo "the directory $whack_dir does not exist."
- exit 3
-fi
-
-# test the tasty remote location with the better contents.
-pushd "$exemplar_dir" &>/dev/null
-if [ $? -ne 0 ]; then
- # an error getting to this directory means its no good for us.
- echo "the directory $exemplar_dir is inaccessible."
- exit 2
-fi
-the_good_place="$(pwd)"
-popd &>/dev/null
-
-if [ ! -z "$whack_dir" ]; then
- # use the directory as our "current" location.
- pushd "$whack_dir" &>/dev/null
-fi
-
-# now that we're in the directory to clean, make sure we're good there.
-if [ ! -d ".svn" ]; then
-# echo "Could not find a subversion directory; operation would be pointless."
- exit 0
-fi
-
-current_dir="$(pwd)"
-
-#echo "currdir=$current_dir gooddir=$the_good_place"
-
-if [ "$current_dir" == "$the_good_place" ]; then
- # this is not good; they're the same location.
- echo "the request would whack all the files in the current directory; ignoring."
- exit 4
-fi
-
-# do the real work now...
-for i in *; do
- if [ -f "$exemplar_dir/$i" ]; then
- echo "whacking $i"
- svn rm "$i"
- fi
-done
-
-if [ ! -z "$whack_dir" ]; then
- popd &>/dev/null
-fi
-
+++ /dev/null
-#!/bin/bash
-# a simple script for updating a set of folders on a usb stick from subversion or git.
-# currently
-# just runs with no parameters and expects to get all archives from wherever the files originally
-# came from.
-
-dir="$1"; shift
-if [ -z "$dir" ]; then
- dir=.
-fi
-
-pushd "$dir" &>/dev/null
-
-for i in * ; do
- if [ -d "$i" ]; then
- echo "[$i]"
- pushd $i &>/dev/null
- # only update if we see a repository living there.
- if [ -d ".svn" ]; then
- svn update .
- elif [ -d ".git" ]; then
- git pull
- elif [ -d "CVS" ]; then
- cvs update .
- fi
- popd &>/dev/null
- echo "======="
- fi
-done
-
-popd &>/dev/null
-
-
--- /dev/null
+#!/bin/bash
+
+# these are helper functions for doing localized revision control.
+# this script should be sourced into other scripts that use it.
+
+# one unpleasantry to take care of first; cygwin barfs aggressively if the TMP directory
+# is a DOS path, but we need it to be a DOS path for our XSEDE testing, so that blows.
+# to get past this, TMP gets changed below to a hopefully generic and safe place.
+
+if [[ "$TMP" =~ .:.* ]]; then
+ echo making weirdo temporary directory for DOS path.
+ export TMP=/tmp/rev_control_$USER
+fi
+if [ ! -d "$TMP" ]; then
+ mkdir $TMP
+fi
+if [ ! -d "$TMP" ]; then
+ echo "Could not create the temporary directory TMP in: $TMP"
+ echo "This script will not work properly without an existing TMP directory."
+fi
+
+this_host=
+# gets the machine's hostname and stores it in the variable "this_host".
+function get_our_hostname()
+{
+ if [ "$OS" == "Windows_NT" ]; then
+ this_host=$(hostname)
+ elif [ ! -z "$(echo $MACHTYPE | grep apple)" ]; then
+ this_host=$(hostname)
+ elif [ ! -z "$(echo $MACHTYPE | grep suse)" ]; then
+ this_host=$(hostname --long)
+ else
+ this_host=$(hostname)
+ fi
+ #echo "hostname is $this_host"
+}
+
+# this function sets a variable called "home_system" to "true" if the
+# machine is considered one of fred's home machines. if you are not
+# fred, you may want to change the machine choices.
+export home_system=
+function is_home_system()
+{
+ # load up the name of the host.
+ get_our_hostname
+ # reset the variable that we'll be setting.
+ home_system=
+ if [[ $this_host == *.gruntose.blurgh ]]; then
+ home_system=true
+#temp code
+elif [[ $this_host == buildy ]]; then
+home_system=true
+elif [[ $this_host == simmy ]]; then
+home_system=true
+#temp code
+ fi
+}
+
+# we only want to totally personalize this script if the user is right.
+function check_user()
+{
+ if [ "$USER" == "fred" ]; then
+ export SVNUSER=fred_t_hamster@
+ export EXTRA_PROTOCOL=+ssh
+ else
+ export SVNUSER=
+ export EXTRA_PROTOCOL=
+ fi
+}
+
+# calculates the right modifier for hostnames / repositories.
+modifier=
+function compute_modifier()
+{
+ modifier=
+ directory="$1"; shift
+ in_or_out="$1"; shift
+ check_user
+ # some project specific overrides.
+ if [[ "$directory" == hoople* ]]; then
+ modifier="svn${EXTRA_PROTOCOL}://${SVNUSER}svn.code.sf.net/p/hoople2/svn/"
+ fi
+ if [[ "$directory" == yeti* ]]; then
+ modifier="svn${EXTRA_PROTOCOL}://${SVNUSER}svn.code.sf.net/p/yeti/svn/"
+ fi
+ # see if we're on one of fred's home machines.
+ is_home_system
+ # special override to pick local servers when at home.
+ if [ "$home_system" == "true" ]; then
+ if [ "$in_or_out" == "out" ]; then
+ # need the right home machine for modifier when checking out.
+ modifier="svn://shaggy/"
+ else
+ # no modifier for checkin.
+ modifier=
+ fi
+ fi
+}
+
+# selects the method for check-in based on where we are.
+function do_checkin()
+{
+ local directory="$1"; shift
+ pushd "$directory" &>/dev/null
+ if [ -d "CVS" ]; then cvs ci . ;
+ elif [ -d ".svn" ]; then svn ci . ;
+ elif [ -d ".git" ]; then
+ # snag all new files. not to everyone's liking.
+ git add .
+ # tell git about all the files and get a check-in comment.
+ git commit .
+ # upload the files to the server so others can see them.
+ git push 2>&1 | grep -v "X11 forwarding request failed"
+ else
+ echo unknown repository for $directory...
+ fi
+ popd &>/dev/null
+}
+
+# checks in all the folders in a specified list.
+function checkin_list {
+ local list=$*
+ 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
+
+# pushd $j &>/dev/null
+ echo "checking in '$j'..."
+ do_checkin $j
+# popd &>/dev/null
+ done
+ done
+}
+
+# takes out the first few carriage returns that are in the input.
+function squash_first_few_crs()
+{
+ i=0
+ while read line; do
+ i=$((i+1))
+ if [ $i -le 3 ]; then
+ echo -n "$line "
+ else
+ echo $line
+ fi
+ done
+ if [ $i -le 3 ]; then
+ # if we're still squashing eols, make sure we don't leave them hanging.
+ echo
+ fi
+}
+
+# selects the checkout method based on where we are (the host the script runs on).
+function do_update()
+{
+ directory="$1"; shift
+
+ pushd "$directory" &>/dev/null
+ if [ -d "CVS" ]; then
+ cvs update . | squash_first_few_crs
+ elif [ -d ".svn" ]; then
+ svn update . | squash_first_few_crs
+ elif [ -d ".git" ]; then
+ git pull 2>&1 | grep -v "X11 forwarding request failed" | squash_first_few_crs
+ else
+ echo unknown repository for $directory...
+ fi
+ popd &>/dev/null
+}
+
+# gets all the updates for a list of folders under revision control.
+function checkout_list {
+ list=$*
+ 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
+ done
+}
+