diff options
Diffstat (limited to 'support/scripts')
-rwxr-xr-x | support/scripts/cvs-remove-directory | 10 | ||||
-rw-r--r-- | support/scripts/cvs-remove-directory.sh | 54 |
2 files changed, 64 insertions, 0 deletions
diff --git a/support/scripts/cvs-remove-directory b/support/scripts/cvs-remove-directory new file mode 100755 index 0000000000..a56c9e8263 --- /dev/null +++ b/support/scripts/cvs-remove-directory @@ -0,0 +1,10 @@ +#!/bin/bash +########################################################-*-Shell-script-*-#### +# CVS-Remove-Directory Command +############################################################################## +# $Id$ + +source $0.sh; +${0##*/} "$@"; + +############################################################################## diff --git a/support/scripts/cvs-remove-directory.sh b/support/scripts/cvs-remove-directory.sh new file mode 100644 index 0000000000..db46589b1f --- /dev/null +++ b/support/scripts/cvs-remove-directory.sh @@ -0,0 +1,54 @@ +########################################################-*-Shell-script-*-#### +# CVS-Remove-Directory Function +############################################################################## +# $Id$ + +source ${0%/*}/stdlib.sh; + +############################################################################## +# cvs-move-directory + +function cvs-remove-directory-usage() { + echo "Usage: $program <source-directory>"; +} + +function cvs-remove-directory-args() { + case "$1" in + -? | -h | --help ) $program-usage; exit 0;; + --verbose ) verbose=true; return 1;; + --version ) echo "$program (bash script) $version";exit 0;; + -* ) args-option-unknown "$@";; + * ) args-append-array args "$@";; + esac; +} + +function cvs-remove-directory() { + local program="$FUNCNAME"; + local version='$Revision$'; + local -a args; + args-loop "$@"; + + # get source and destination directories + [ ${#args[@]} == 1 ] || { $program-usage 1>&2; exit 1; }; + local src_dir="${args[0]}"; + + if [ ! -d "$src_dir" ]; then + abort "could not find source directory '$src_dir'"; + fi; + if [ ! -d "$src_dir/CVS" ]; then + abort "source directory '$src_dir' is not cvs-controlled"; + fi; + + local src_name=`basename "$src_dir"`; + local src_parent=`dirname "$src_dir"`; + local src_entries="$src_parent/CVS/Entries"; + + if [ ! -f "$src_entries" ]; then + abort "could not find source entry file '$src_entries'"; + fi; + + runO "$src_entries~" grep -v "D/$src_name////" "$src_entries"; + run mv "$src_entries~" "$src_entries"; +} + +############################################################################## |