#! /bin/bash
# usage accunotes.sh new_release_snapshot old_release_snapshot

snap1=$1
snap2=$2

awk_cmd="\$1 != \"Stream\" { if(\"Y\" == \$(NF)) { print \"now\"; } else { print \$(NF-1) \" \" \$(NF); }}"

end_date=`accurev show -s ${snap1} streams  | awk "${awk_cmd}"`

start_date=`accurev show -s ${snap2} streams  | awk "${awk_cmd}"`

cat <<EOF > ${snap1}_files.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="files.xsl"?>
EOF

accurev hist -t "${end_date}-${start_date}" -k promote -s dta -fx >> ${snap1}_files.xml

cat <<EOF > ${snap1}_issues.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="issues.xsl"?>
EOF

accurev issuediff -s ${snap1} -S ${snap2} -fx >> ${snap1}_issues.xml 
