#!/bin/bash
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#

USAGE="[<patchname>]"
. guilt

if [ $# -gt 1 ]; then
	usage
fi

patch="$1"

if [ -z "$patch" ]; then
	# use the patch that's on the top of the stack

	eidx=`wc -l < $applied`
	if [ $eidx -eq 0 ]; then
		die "Status file is empty"
	fi
else
	# use the specified patch

	eidx=`get_series | grep -ne "^$patch\$" | cut -d: -f1`
	if [ $eidx -eq 0 ]; then
		die "Patch $patch is not in the series"
	fi
fi

idx=0
for p in `get_series`; do
	idx=`expr $idx + 1`
	[ $idx -lt $eidx ] && continue
	[ $idx -gt $eidx ] && break

	do_get_header $GUILT_DIR/$branch/$p
done

