1
0
Fork 0
lvspec/tools/gentasktime

50 lines
974 B
Plaintext
Raw Normal View History

2013-08-28 13:56:10 -04:00
#!/bin/bash
src="${1?Missing source document}"
path="${2?Missing spec src path}"
2013-08-28 13:56:10 -04:00
domake()
{
pdflatex -draftmode "$src" >&2
}
gendate()
{
echo -n "$( git log -n1 --pretty=format:%ai | cut -d' ' -f1 ) "
}
domake \
&& echo -n 'id ' \
&& head -n1 taskstats.dat \
&& \
(
echo -n '0 ' && gendate && tail -n1 taskstats.dat \
&& git log --no-merges --pretty=format:'%ar %h' -- "$path" \
2013-08-28 13:56:10 -04:00
| awk '
BEGIN {
last=""
}
/(days|weeks) ago|^(1[5-9]|2[0-9]) hours ago/{
2013-08-30 09:03:29 -04:00
if ( $0 ~ /hours/ ) {
$1 = 1
}
if ( $0 ~ /weeks/ ) {
$1 = $1*7
}
2013-08-28 13:56:10 -04:00
if ( $1 == last ) next;
if ( $1 < last ) next;
2013-08-28 13:56:10 -04:00
last = $1;
print $1, $NF;
}
' \
| while read n h; do
git checkout "$h" >&2 \
&& domake \
&& echo -n "-$n " \
2013-08-28 13:56:10 -04:00
&& gendate \
&& tail -n1 taskstats.dat \
|| { echo "Aborting data gathering."; exit 1; }
2013-08-28 13:56:10 -04:00
done
)