barrier/nodist/p4tolog

32 lines
715 B
Plaintext
Raw Normal View History

#!/bin/sh
# convert p4 logs to ChangeLog
#
# usage: p4tolog [file[revRange] ...]
#
# changes are written to stdout
# location of perforce client
P4=/home/perforce/bin/p4
# get relevant changes
changes=`$P4 changes $* | sed -e 's/Change \([0-9]*\).*/\1/'`
if test -z "$changes"; then
echo "No changes"
exit 0
fi
# convert each change
for change in $changes; do
$P4 describe -s $change | head -1 | \
sed -e 's/.*by \([^ ]*\) on \([^ ]*\) \([^ ]*\)/\2 \3 \1/'
$P4 describe -s $change | \
awk 'p==1 && !/^$/;/^Affected/{p=1}' | \
sed -e 's/^[^ ]* \([^#]*\)#.*$/\1/'
echo
$P4 describe -s $change | \
awk 'p==1 && !/$^/;/^$/{if (p==1) exit; else p=1}' | \
sed -e 's/^.//'
echo
echo "----------"
done