Author: toad
Date: 2007-05-10 11:27:01 +0000 (Thu, 10 May 2007)
New Revision: 13196
Modified:
trunk/scripts/verify-whitespace-patch.sh
Log:
New version of verify-whitespace-patch, allows for renames with sed scripts
Modified: trunk/scripts/verify-whitespace-patch.sh
===================================================================
--- trunk/scripts/verify-whitespace-patch.sh 2007-05-10 11:26:01 UTC (rev
13195)
+++ trunk/scripts/verify-whitespace-patch.sh 2007-05-10 11:27:01 UTC (rev
13196)
@@ -1,25 +1,26 @@
#!/bin/bash
-# The cvs at freenetproject.org list receives all commits, apart from huge
commits which are
-# simply unpacking a tarfile. The objective is to make it easy to reconstruct
the history
-# from human-readable patches.
-
-# This script verifies that a patch from the CVS list is in fact pure
whitespace, or shows
-# the bits that are not whitespace.
WORKINGCOPY=/usr/src/cvs/eclipse-workspace/Freenet\ 0.7
echo -n "Please enter revision number after patch applied? "
read REVISION
OLDREVISION=$(($REVISION-1))
echo -n "Please enter location of patch from mailing list? "
read FILENAME
+if [[ -z $FILENAME ]] ; then FILENAME=/home/toad/${REVISION}.diff; fi
+echo Filename: "$FILENAME"
+echo -n "Please enter sed script?"
+read SEDSCRIPT
# Make a temporary directory
TEMPDIR=`mktemp -d ~/verify-patch-temp-XXXXXXXXXX`
echo Temporary directory: $TEMPDIR
-OLDDIR=$TEMPDIR/old
-NEWDIR=$TEMPDIR/new
+OLDDIR=${TEMPDIR}/old
+NEWDIR=${TEMPDIR}/new
mkdir $OLDDIR $NEWDIR
+echo "Old dir: $OLDDIR"
+echo "New dir: $NEWDIR"
cp -a "$WORKINGCOPY" $OLDDIR/
cd $OLDDIR
DNAME=`ls`
+echo DNAME = "$DNAME"
mv */* */.[a-z0-9]* .
rm -R "$DNAME"
svn revert -R .
@@ -28,8 +29,13 @@
find -iname .svn | xargs rm -R
rm -R .[a-z0-9]*
cp -a $OLDDIR/* $NEWDIR
+if [[ -n $SEDSCRIPT ]]; then
+ cd $OLDDIR
+ find . -type f -iname "*.java" | (while read x; do cat "$x" | sed
"$SEDSCRIPT" > "$x.1"; mv "$x.1" "$x"; done)
+ find `pwd` -type d | (while read x; do cd "$x"; rename "$SEDSCRIPT" *;
done)
+fi
cd $NEWDIR
if ! patch -p2 < $FILENAME ; then exit Failed to apply patch ; else echo
Applied patch successfully. ; fi
-diff -urw $OLDDIR $NEWDIR > $TEMPDIR/diff-uw
-if [ -s $TEMPDIR/diff-uw ] ; then less $TEMPDIR/diff-uw ; mv $TEMPDIR/diff-uw
~/${REVISION}.diff ; echo Saved diff in ~/${REVISION}.diff ; else echo No
differences found after compensating for whitespace; fi
+diff -Nurw "$OLDDIR" "$NEWDIR" > $TEMPDIR/diff-uw
+if [ -s $TEMPDIR/diff-uw ] ; then less $TEMPDIR/diff-uw ; else echo No
differences found after compensating for whitespace; fi
rm -R $TEMPDIR