diff options
author | Martin Quinson <mquinson@debian.org> | 2003-01-21 09:49:29 +0000 |
---|---|---|
committer | Martin Quinson <mquinson@debian.org> | 2003-01-21 09:49:29 +0000 |
commit | 02dc4a5f8c1979e9a23f7b6851f693d29b640c4d (patch) | |
tree | 2f397f5df89f4529b89fd0e7a021238d0f290007 /needs-checking/cvs-take-patch | |
parent | 4d11e99bfc25e0261111d202a3a2afdf97daea5c (diff) | |
download | quilt-02dc4a5f8c1979e9a23f7b6851f693d29b640c4d.tar.gz |
Version 0.11, from Andreas Gruenbacher
Diffstat (limited to 'needs-checking/cvs-take-patch')
-rwxr-xr-x | needs-checking/cvs-take-patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/needs-checking/cvs-take-patch b/needs-checking/cvs-take-patch new file mode 100755 index 0000000..c6a6a2a --- /dev/null +++ b/needs-checking/cvs-take-patch @@ -0,0 +1,78 @@ +#!/bin/sh + +doit() +{ + echo $* + $* +} + +usage() +{ + echo "Usage: cvs-take-patch patch_file_name" + exit 1 +} + +# +# Find the highest level directory in $1 which does not +# contain the directory $2. Return it in $MISSING +# +highest_missing() +{ + START_DIR="$1" + NAME="$2" + MISSING="" + WHERE=$(dirname "$START_DIR") + PREV_WHERE=$START_DIR + while [ x"$WHERE" != x"$PREV_WHERE" ] + do + WHERE="$PREV_WHERE" + if [ ! -d "$WHERE"/"$NAME" ] + then + MISSING="$WHERE" + fi + PREV_WHERE=$(dirname "$WHERE") + done + echo highest_missing returns $MISSING +} + +# +# Add all new directries to CVS, top-down +# $1: name of a directory +# $2: name of the CVS directory +# +add_cvs_dirs() +{ + MISSING=foo + while [ "$MISSING" != "" ] + do + highest_missing $1 $2 + if [ x"$MISSING" != "x" ] + then + if [ ! -d "$MISSING"/"$2" ] + then + doit cvs add $MISSING + fi + fi + done +} + +PATCHFILE=$1 + +REMOVEDFILES=$(removed-by-patch $PATCHFILE) +if [ "$REMOVEDFILES" != "" ] +then + doit cvs remove $REMOVEDFILES +fi + +NEWFILES=$(added-by-patch $PATCHFILE) +for i in $NEWFILES +do + DIRNAME=$(dirname $i) + echo "Looking at $DIRNAME" + add_cvs_dirs $DIRNAME CVS +done + +if [ "$NEWFILES" != "" ] +then + doit cvs add $NEWFILES +fi |