# $Id: //info.ravenbrook.com/project/mps/tool/rcs-import/branches.sh#2 $
# Script to estimate the date of an (unlabelled) branch. See
# //info.ravenbrook.com/mail/2001/08/14/18-15-36/0.txt.

P4PORT=`hostname`:1666
export P4PORT

for branch in `p4 sync -n| awk -F/ '{print $4}'|sort -u`
do
  echo -n "$branch"
  p4 filelog //depot/$branch/... | 
   awk '/#1 change/{print $4}' |sort|uniq|head  -1 |
   xargs p4 change -o |grep '^Date:'|awk '{printf "\t%s\n", $2}' | 
   sed "s+/+-+g"
done
