#!/bin/bash

TAG=`bk changes | fgrep TAG | fgrep v2. | head -n 1 | awk '{print $2}'`

echo Generating patches against tag $TAG

bk rset -h -r${TAG},+ | egrep ^arch/i386 | bk gnupatch -h > i386.patch
bk rset -h -r${TAG},+ | egrep ^include/asm-i386 | bk gnupatch -h >> i386.patch

bk rset -h -r${TAG},+ | egrep ^arch/ppc | bk gnupatch -h > ppc.patch
bk rset -h -r${TAG},+ | egrep ^include/asm-ppc | bk gnupatch -h >> ppc.patch

bk rset -h -r${TAG},+ | egrep ^arch/alpha | bk gnupatch -h > alpha.patch
bk rset -h -r${TAG},+ | egrep ^include/asm-alpha | bk gnupatch -h >> alpha.patch

bk rset -h -r${TAG},+ | egrep ^arch/mips | bk gnupatch -h > mips.patch
bk rset -h -r${TAG},+ | egrep ^include/asm-mips | bk gnupatch -h >> mips.patch

bk rset -h -r${TAG},+ | egrep -v ^BitKeeper | bk gnupatch -h > kernel.patch

