X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f Date: Sun, 07 Sep 2003 13:19:03 +0100 From: "Richard Dawe" Sender: rich AT phekda DOT freeserve DOT co DOT uk To: djgpp-workers AT delorie DOT com X-Mailer: Emacs 21.3.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6 Subject: listfile2diff.sh Message-Id: Reply-To: djgpp-workers AT delorie DOT com Hello. Below is the script I've started using to generate patches for DJGPP. You give it a list file like this: include/stdlib.h src/libc/ansi/stdlib/foo.c and it'll generate a patch for you. E.g.: listfile2diff.sh foo-files.txt -pu3 It copes with files that haven't been added to CVS yet. Change 'mycvs' and 'nargs' to respectively: the name of your CVS program (I use a bash shell script wrapper) and the number of filenames to pass to CVS (I use two, to avoid command-line overflow). Maybe it'll be useful for someone else. Bye, Rich =] #!/bin/sh mycvs=cvsw nargs=2 debug=0 if [ "a$1" = "a-g" ]; then debug=1 shift set -x fi listfile=$1 shift if [ "a$listfile" = "a" ]; then echo "Syntax: $0 " exit 1 fi if [ ! -r $listfile ]; then echo "Unable to read file list from $1" exit 1 fi files=`cat $listfile` # Check that all the files exist. ok=1 for i in $files; do if [ ! -r $i ]; then echo "ERROR: $i does not exist!" ok=0 fi done if [ "a$ok" = "a0" ]; then exit 1 fi # Work out which files already exist in CVS and which are new. existingfiles= newfiles= for i in $files; do b=$(basename $i) d=$(dirname $i) e=$d/CVS/Entries if [ ! -r $e ]; then newfiles="$newfiles $i" else grep $b $e >/dev/null 2>&1 if [ "a$?" = "a0" ]; then existingfiles="$existingfiles $i" else newfiles="$newfiles $i" fi fi done if [ "a$debug" = "a1" ]; then echo "Existing files: $existingfiles" echo "New files: $newfiles" fi # Generate a diff. if [ "a$existingfiles" != "a" ]; then echo $existingfiles | xargs -n $nargs $mycvs diff $* fi for i in $newfiles; do diff $* /dev/null $i done