#!/bin/bash

export CHANGELIST=${CHANGELIST:-Undefined} 
export CHANGELIST=${1:-$CHANGELIST} 
if [[ $CHANGELIST == Undefined ]]; then 
   echo " parameter not supplied." 
   echo "You must supply the shelf changelist number as a parameter to this script." 
   exit 1 
fi 

for depotFile in $(p4 -ztag -F %depotFile% files @=$CHANGELIST); do
  lbrFile=$(p4 -F %lbrPath% fstat -Ob $depotFile@=$CHANGELIST)
  rsync -av $lbrFile ${RSYNCUSER}@${COMMITSERVER}:$lbrFile
done
