#!/bin/bash
#
# $1=port $2=workspace $3=CL $4=project name
#
# xinmin.su 2012/11/15
#
function usage()
{
cat << EOF
usage: `basename $0` [options] port workspace CL PROJECT_NAME
options:
-b true : this is beginning of a project
false : this is not beginning of a project, the project is developing
-h : help
for example:
./p4_all_b.sh 1714 CHN-BST_SYS_xinmin.su_1714STEM_bstdev124 cl superior_chn_cmcc for 9268
./p4_all_b.sh 1714 BST_Android_System_SUXINMIN_9105 cl s2vep_chn_open for 9105
./p4_all_b.sh 1714 BST_Android_System_SUXINMIN_9308 cl m0_chn_open for 9308
./p4_all_b.sh 1713 CHINA_TERMINAL_G1_SXM_Vasto-i cl vastoi_chn_cmcc for 8258
EOF
}
projectBegin="false"
while getopts "b:h" flag; do
case $flag in
b) projectBegin=$OPTARG;;
h) usage;exit 0;;
esac
done
shift $((OPTIND-1))
p4 -p 109.105.1.55:$1 login << EOL
Lovejie0
EOL
if [[ $BASH_ARGC != 4 ]]
then
usage; exit 1;
fi
export P4PORT=109.105.1.55:$1
if [[ $projectBegin == "true" ]]
then
p4 -c $2 sync //$2/...@0
fi
p4 -c $2 sync //$2/...@$3
cd android
rm -rf out/
cd ../buildscript
./build $4