Modification time: 2007-01-07 12:00:43 -0500
# -- Matt McCutchen
# If I had to update the version in the --version message separately, I would forget.
# -- Matt McCutchen
# If I had to update the version in the --version message separately, I would forget.
# usage: patchsync [--dry-run] <staging> [branch | patch]
#
# usage: patchsync [--dry-run] <staging> [branch | patch]
#
type rsync >/dev/null 2>&1 || \
{ echo "Patchsync requires rsync, but there's no rsync on your path!" 1>&2; exit 1; }
# If a cp2 is available, use it; otherwise define our own.
type rsync >/dev/null 2>&1 || \
{ echo "Patchsync requires rsync, but there's no rsync on your path!" 1>&2; exit 1; }
# If a cp2 is available, use it; otherwise define our own.
-type cp2 >/dev/null 2>&1 || function cp2 { rsync -rltE --chmod=ugo=rwx "$@"; }
+type cp2 >/dev/null 2>&1 || function cp2 { exec rsync -rltE --chmod=ugo=rwx "$@"; }
function exitoneok {
"$@" || [ $? == 1 ]
function exitoneok {
"$@" || [ $? == 1 ]
cd "$staging" || { echo "Failed to enter staging dir!" 1>&2; exit 1; }
shift
cd "$staging" || { echo "Failed to enter staging dir!" 1>&2; exit 1; }
shift
type do_diff >/dev/null 2>&1 || { echo "do_diff is not defined!" 1>&2; exit 1; }
type do_patch >/dev/null 2>&1 || { echo "do_patch is not defined!" 1>&2; exit 1; }
type do_diff >/dev/null 2>&1 || { echo "do_diff is not defined!" 1>&2; exit 1; }
type do_patch >/dev/null 2>&1 || { echo "do_patch is not defined!" 1>&2; exit 1; }
- # Set up arguments. Open templates because we will change directories.
trunk="$1"
patch="$2"
branch="$3"
staging="$4"
trunk="$1"
patch="$2"
branch="$3"
staging="$4"
- # What exists? Whichtochange first?
! [ -e "$staging" ] || { echo "Staging dir already exists!" 1>&2; exit 1; }
[ -d "$trunk" ] || { echo "Trunk does not exist!" 1>&2; exit 1; }
! [ -e "$staging" ] || { echo "Staging dir already exists!" 1>&2; exit 1; }
[ -d "$trunk" ] || { echo "Trunk does not exist!" 1>&2; exit 1; }