barrier/nodist/p4tolog

51 lines
1017 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
2007-09-06 05:01:04 +00:00
#P4=/home/perforce/bin/p4
P4=/usr/local/bin/p4
2007-09-06 05:01:04 +00:00
prefix="//depot/project/synergy/"
while [ -n "$1" ]; do
case "$1" in
-p)
2007-09-06 05:01:04 +00:00
# get depot filespec prefix to strip
prefix="$2"
shift
;;
*)
break
;;
esac
shift
done
2007-09-06 05:01:04 +00:00
# escape slashes in prefix
prefix=`echo $prefix | sed -e 's#/#\\\\/#g'`
# 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/' | sed -e "s/^$prefix//"
echo
$P4 describe -s $change | \
2007-09-06 05:01:04 +00:00
awk 'p==1 && !/^$/;/^$/{if (p==1) exit; else p=1}' | \
sed -e 's/^.//'
echo
echo "----------"
done