2002-08-02 21:57:03 +00:00
|
|
|
#!/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
|
2002-08-02 21:57:03 +00:00
|
|
|
|
2007-09-06 05:01:04 +00:00
|
|
|
prefix="//depot/project/synergy/"
|
2002-12-25 19:20:12 +00:00
|
|
|
while [ -n "$1" ]; do
|
|
|
|
case "$1" in
|
|
|
|
-p)
|
2007-09-06 05:01:04 +00:00
|
|
|
# get depot filespec prefix to strip
|
|
|
|
prefix="$2"
|
2002-12-25 19:20:12 +00:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2007-09-06 05:01:04 +00:00
|
|
|
# escape slashes in prefix
|
|
|
|
prefix=`echo $prefix | sed -e 's#/#\\\\/#g'`
|
|
|
|
|
2002-08-02 21:57:03 +00:00
|
|
|
# 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 | \
|
2002-12-25 19:20:12 +00:00
|
|
|
sed -e 's/.*by \([^ @]*\)[^ ]* on \([^ ]*\) \([^ ]*\)/\2 \3 \1/'
|
2002-08-02 21:57:03 +00:00
|
|
|
$P4 describe -s $change | \
|
|
|
|
awk 'p==1 && !/^$/;/^Affected/{p=1}' | \
|
2002-12-25 19:20:12 +00:00
|
|
|
sed -e 's/^[^ ]* \([^#]*\)#.*$/\1/' | sed -e "s/^$prefix//"
|
2002-08-02 21:57:03 +00:00
|
|
|
echo
|
|
|
|
$P4 describe -s $change | \
|
2007-09-06 05:01:04 +00:00
|
|
|
awk 'p==1 && !/^$/;/^$/{if (p==1) exit; else p=1}' | \
|
2002-08-02 21:57:03 +00:00
|
|
|
sed -e 's/^.//'
|
|
|
|
echo
|
|
|
|
echo "----------"
|
|
|
|
done
|