[ -d $tmpdir ] || mkdir $tmpdir
cd $tmpdir || exit 1
-[ -d ,workdir ] || mkdir ,workdir
-echo "Using CVS to update the $tmpdir/,cvsdir copy of the source."
-cvs -d "$root" co -d ,cvsdir rsync
+[ -d workdir ] || mkdir workdir
+echo "Using CVS to update the $tmpdir/cvsdir copy of the source."
+cvs -d "$root" co -d cvsdir rsync
-cd ,workdir || exit 1
+cd workdir || exit 1
if [ -z "$1" ]; then
set -- ../../*.diff
*.diff) xx=../../$xx ;;
*) continue ;;
esac
- rsync -a --delete ../,cvsdir/ .
- echo -e "\n----------- $xx ------------"
- patch -p0 <$xx | tee ,patch.output
- new=''
- for nn in `sed -n 's/^patching file //p' ,patch.output`; do
- [ -f ../,cvsdir/$nn ] || new="$new $nn"
- done
+ apply=y
while : ; do
- echo -ne "\nFix rejections, Make proto.h, Edit diffs, Update, Next, Quit: [n] "
+ echo -e "\n----------- $xx ------------"
+ if [ $apply = y ]; then
+ rsync -a --delete ../cvsdir/ .
+ patch -p0 <$xx | tee ,patch.output
+ new=''
+ for nn in `sed -n 's/^patching file //p' ,patch.output`; do
+ [ -f ../cvsdir/$nn ] || new="$new $nn"
+ done
+ if grep "^Hunk #[0-9]* FAILED" ,patch.output >/dev/null; then
+ default=F
+ elif grep "^Hunk #[0-9]* succeeded" ,patch.output >/dev/null; then
+ default=E
+ else
+ default=N
+ fi
+ apply=n
+ fi
+ echo -e "\nFix rejects, Edit both diffs, Update patch,"
+ echo -n "Apply patch again, Next, Quit: [$default] "
read ans
+ [ -z "$ans" ] && ans=$default
case "$ans" in
[Ee]*)
[ ! -z "$new" ] && cvs add $new
new=''
- rm -f *.rej *.orig
- cvs diff -N | grep -v '^Index: ' |
- grep -v '^=========' |
- grep -v '^diff -' |
- grep -v '^RCS file: ' |
- grep -v '^retrieving revision ' >,new.patch
+ rm -f *.rej *.orig */*.rej */*.orig
+ sed '/^--- /,$ d' $xx >,new.patch
+ cvs diff -N | egrep -v '^(diff -|===============|RCS file: |retrieving revision |Index: )' >>,new.patch
vim -d $xx ,new.patch
+ default=U
;;
[Ff]*)
- vim *.rej
- ;;
- [Mm]*)
- cat *.c lib/compat.c | awk -f mkproto.awk >proto.h
- echo -e "\nRegenerated proto.h"
+ vim `sed -ne 's/.* saving rejects to file //p' ,patch.output`
+ default=E
;;
[Uu]*)
if [ -f ,new.patch ]; then
cp -p ,new.patch $xx
echo -e "\nCopied ,new.patch to $xx"
+ default=A
else
echo -e "\n*** Edit the diffs first. ***"
+ default=E
fi
;;
- [Nn]*|'')
+ [Aa]*)
+ apply=y
+ ;;
+ [Nn]*)
break
;;
[Qq]*)