Modified to work with the trunk's hash_search() optimization.
[rsync/rsync-patches.git] / verify-patches
... / ...
CommitLineData
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`
12tmpdir=,tmp-for-patch-tests
13
14[ -d $tmpdir ] || mkdir $tmpdir
15cd $tmpdir || exit 1
16
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
23if [ -z "$1" ]; then
24 set -- ../../*.diff
25fi
26
27for xx in "${@}"; do
28 case "$xx" in
29 *gzip-rsyncable.diff) continue ;;
30 patches/*) xx=`echo $xx | sed 's:patches:../..:'` ;;
31 */*.diff) ;;
32 *.diff) xx=../../$xx ;;
33 *) continue ;;
34 esac
35 apply=y
36 while : ; do
37 echo -e "\n----------- $xx ------------"
38 if [ $apply = y ]; then
39 rsync -a --delete ../cvsdir/ .
40 patch -p0 <$xx | tee ,patch.output
41 new=''
42 for nn in `sed -n 's/^patching file //p' ,patch.output`; do
43 [ -f ../cvsdir/$nn ] || new="$new $nn"
44 done
45 if grep "^Hunk #[0-9]* FAILED" ,patch.output >/dev/null; then
46 default=F
47 elif grep "^Hunk #[0-9]* succeeded" ,patch.output >/dev/null; then
48 default=E
49 else
50 default=N
51 fi
52 apply=n
53 fi
54 echo -e "\nFix rejects, Edit both diffs, Update patch,"
55 echo -n "Apply patch again, Next, Quit: [$default] "
56 read ans
57 [ -z "$ans" ] && ans=$default
58 case "$ans" in
59 [Ee]*)
60 [ ! -z "$new" ] && cvs add $new
61 new=''
62 rm -f *.rej *.orig */*.rej */*.orig
63 sed '/^--- /,$ d' $xx >,new.patch
64 cvs diff -N |
65 egrep -v '^(diff -|===============|RCS file: |retrieving revision |Index: )' |
66 sed -e 's:^--- a/:--- :' -e 's:^+++ b/:+++ :' >>,new.patch
67 vim -d $xx ,new.patch
68 default=U
69 ;;
70 [Ff]*)
71 vim `sed -ne 's/.* saving rejects to file //p' ,patch.output`
72 default=E
73 ;;
74 [Uu]*)
75 if [ -f ,new.patch ]; then
76 cp -p ,new.patch $xx
77 echo -e "\nCopied ,new.patch to $xx"
78 default=A
79 else
80 echo -e "\n*** Edit the diffs first. ***"
81 default=E
82 fi
83 ;;
84 [Aa]*)
85 apply=y
86 ;;
87 [Nn]*)
88 break
89 ;;
90 [Qq]*)
91 exit 0
92 ;;
93 esac
94 done
95done