#!/bin/sh ########################### # p4co # # a simple tool to pull a new perforce tree # Usage: # p4co # # which matches a directory in: //depot/main/ # # Written by David Jeske # # This code is in the public domain. Pretend there # is a fancy legal disclaimer here limiting liability. # if [ $# != 1 ]; then echo "Usage:" echo " p4co " exit 1 fi MODULE=$1 if [ -d $MODULE ]; then echo "$MODULE is a directory! Please move it out of the way" exit 1 fi if [ ! ${P4CONFIG} ]; then echo "You must set P4CONFIG to something, like '.p4rc'." exit 1 fi mkdir $MODULE cd $MODULE CLIENTDIR="${PWD}" TIMET=`date +"%s"` CLIENTNAME="${USER}${TIMET}" echo $CLIENTNAME CLIENTFILE=.p4clientspec echo "Client: $CLIENTNAME" > $CLIENTFILE echo "Owner: $USER" >> $CLIENTFILE echo "Description:" >> $CLIENTFILE echo " Autocreated by p4co" >> $CLIENTFILE echo "Root: $CLIENTDIR" >> $CLIENTFILE echo "View:" >> $CLIENTFILE echo " //depot/main/${MODULE}/... //${CLIENTNAME}/..." >> $CLIENTFILE p4 client -i < $CLIENTFILE echo "P4CLIENT=${CLIENTNAME}" > $P4CONFIG p4 sync