David Ford wrote:
>
> I need a tool for comparing patch sets with other patch sets. I.e. I
> want to grab all the new parts of pre6-5 compared to pre6-3.
attached is the quick hack i wrote to do this some time ago. it was
mostly done to have a reference for testing another tool; it is not
meant as a final solution. do not use unless you know what it does;
you may have to delete the "bag" calls.
diff2 /img/linux-2.3.99pre5/ pre6-3.gz pre6-5.gz
[ where the first arg is a clean source tree; 2nd and 3rd are the
two diffs; and the result is a unified diff on stdout.]
> Does such a tool exist or should I whip up a quick sed script?
i'd like to see this implemented in sed :^)
["this" being the right thing, ie using only the diffs, not
needing the full source tree. i did this in pike (it's part
of a bigger project, in the middle of a rewrite and not very
useful right now]
#!/bin/bash
echo >&2 "Clearing trees..."
rm -rf /tmp/dd
mkdir -p /tmp/dd/1 /tmp/dd/2
CURDIR=`pwd`
DIFF1=$CURDIR/$2
DIFF2=$CURDIR/$3
case "$DIFF1" in
*.gz) gzip -dc $DIFF1 >/tmp/dd/p1; DIFF1=/tmp/dd/p1 ;;
esac
case "$DIFF2" in
*.gz) gzip -dc $DIFF2 >/tmp/dd/p2; DIFF2=/tmp/dd/p2 ;;
esac
cd "$1"
gawk '
/^--- / && $7>1970 {
gsub("^(linux|v)[0-9aspre\.\-]*/", "", $2);
gsub("^linux/", "", $2);
#print $2 $7
f[$2]=1
}
END {
print "Copying 1st tree..." >"/dev/stderr"
for ( s in f )
{
printf " " s " \r" >"/dev/stderr"
if ( system( "cp -axP " s " /tmp/dd/1/" ) )
exit
}
}
' $DIFF1 $DIFF2
echo >&2 "Copying 2nd tree... "
cp -axl /tmp/dd/1/* /tmp/dd/2
echo >&2 "Patching 1st tree..."
cd /tmp/dd/1/ && patch -s -p1 -E <$DIFF1
echo >&2 "Patching 2nd tree..."
cd /tmp/dd/2/ && patch -s -p1 -E <$DIFF2
echo >&2 "Generating diff..."
cd /tmp/dd/ && diff -urNp 1 2 | bag -b64m -t1
rm -rf /tmp/dd
exit
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:22 EST