#!/bin/sh # -*- coding:utf-8;mode:shell-script;mode:font-lock -*- ## # Recover a directory bundle in which .svn turds got munched. ## # Copyright (c) 2002 Wilfredo Sanchez Vega . # All rights reserved. # # Permission to use, copy, modify, and distribute this software for # any purpose with or without fee is hereby granted, provided that the # above copyright notice, this permission, and the following # disclaimer notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE # AUTHORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ## set -e set -u for target; do # Move target aside tmp=$(mktemp -d "${target}.tmp.XXX"); dst="${tmp}/$(basename "${target}")"; mv "${target}" "${dst}"; # Update the target to refetch .svn turds # FIXME: This really should dupdate to the revision we had, but how? svn cleanup svn update "${target}"; # Move .svn turds to set-aside target for turd in $(cd "${target}" && find . -type d -name .svn | sed 's|^./||'); do parent=$(dirname "${turd}"); mkdir -p "${dst}/${parent}"; cp -Rp "${target}/${turd}" "${dst}/${parent}"; done; # Remove the updated target and move the set-aside back rm -rf "${target}"; mv "${dst}" "${target}"; rm -rf "${tmp}"; done;