#! /bin/sh # run in the wd of a tree to which the patch belongs # depends on tla-diffrevs # # the optional second argument is a subdirectory that # you want to get a patch for # test "$1" = "-l" && { log=yes shift } patchno=${1?} subdir=$2 test -x `dirname $0`/tla-diffrevs || exit 1 prev=`echo $patchno - 1 | bc` if test "$prev" = "0"; then prev=base-0 else prev="patch-$prev" fi test "$subdir" && subdir="-d $subdir" if test "$log" = "yes"; then tla changelog | awk -v target=$patchno ' function pr(r) { if (patchno == target) print r } BEGIN { rec = "start"; patchno = "nope" } /^[0-9]/ { pr(rec) rec = "" patchno = substr($0, match($0, "[0-9]+$")) } { rec = rec "\n" $0 } END { pr(rec) }' fi tla-diffrevs $subdir $prev patch-$patchno