Changed the directory structure a little and added a quit command.
[rsync/rsync-patches.git] / verify-patches
CommitLineData
01dacf6c
WD
1#!/bin/sh
2
3[ -d patches ] && cd patches
4
5if [ ! -f verify-patches ]; then
6 echo "Please run this script from the root of the rsync dir"
7 echo "or from inside the patches subdir."
8 exit 1
9fi
10
11root=`cat ../CVS/Root`
d82d6744 12tmpdir=,tmp-for-patch-tests
01dacf6c
WD
13
14[ -d $tmpdir ] || mkdir $tmpdir
01dacf6c
WD
15cd $tmpdir || exit 1
16
d82d6744
WD
17[ -d ,workdir ] || mkdir ,workdir
18echo "Using CVS to update the $tmpdir/,cvsdir copy of the source."
19cvs -d "$root" co -d ,cvsdir rsync
20
21cd ,workdir || exit 1
22
01dacf6c 23if [ -z "$1" ]; then
d82d6744 24 set -- ../../*.diff
01dacf6c
WD
25fi
26
27for xx in "${@}"; do
28 case "$xx" in
29 *gzip-rsyncable.diff) continue ;;
d82d6744 30 patches/*) xx=`echo $xx | sed 's:patches:../..:'` ;;
01dacf6c 31 */*.diff) ;;
d82d6744 32 *.diff) xx=../../$xx ;;
01dacf6c
WD
33 *) continue ;;
34 esac
d82d6744 35 rsync -a --delete ../,cvsdir/ .
01dacf6c
WD
36 echo -e "\n----------- $xx ------------"
37 patch -p0 <$xx | tee ,patch.output
38 new=''
39 for nn in `sed -n 's/^patching file //p' ,patch.output`; do
d82d6744 40 [ -f ../,cvsdir/$nn ] || new="$new $nn"
01dacf6c
WD
41 done
42 while : ; do
d82d6744 43 echo -ne "\nFix rejections, Make proto.h, Edit diffs, Update, Next, Quit: [n] "
01dacf6c
WD
44 read ans
45 case "$ans" in
01dacf6c
WD
46 [Ee]*)
47 [ ! -z "$new" ] && cvs add $new
48 new=''
49 rm -f *.rej *.orig
50 cvs diff -N | grep -v '^Index: ' |
51 grep -v '^=========' |
52 grep -v '^diff -' |
53 grep -v '^RCS file: ' |
54 grep -v '^retrieving revision ' >,new.patch
55 vim -d $xx ,new.patch
56 ;;
57 [Ff]*)
58 vim *.rej
59 ;;
60 [Mm]*)
61 cat *.c lib/compat.c | awk -f mkproto.awk >proto.h
62 echo -e "\nRegenerated proto.h"
63 ;;
64 [Uu]*)
65 if [ -f ,new.patch ]; then
66 cp -p ,new.patch $xx
67 echo -e "\nCopied ,new.patch to $xx"
68 else
69 echo -e "\n*** Edit the diffs first. ***"
70 fi
71 ;;
d82d6744
WD
72 [Nn]*|'')
73 break
74 ;;
75 [Qq]*)
76 exit 0
77 ;;
01dacf6c
WD
78 esac
79 done
80done