#!/bin/bash export USER=$1 export GerritRepoName=$2 export LocalRepoName=$3 export manifest=./manifest/manifest.xml export xml_branch=$4 if [ -d manifest/ ]; then rm manifest/ -rf fi git clone ssh://*@*.*.*.*:29418/*/manifest && scp -p -P 29418 *@*.*.*.*:hooks/commit-msg manifest/.git/hooks/ cd manifest/ git checkout -b ${xml_branch} --track origin/${xml_branch} cd .. #ssh -p 29418 *@*.*.*.* gerrit ls-projects echo "USER=$USER" echo "GerritRepoName=$GerritRepoName" echo "LocalRepoName=$LocalRepoName" ssh -p 29418 *@*.*.*.* gerrit create-project ${GerritRepoName} --empty-commit if [ u_"$?" = u_"1" ]; then echo "${GerritRepoName} ProjectName already exists" exit -1 fi ssh -p 29418 *@*.*.*.* gerrit create-branch ${GerritRepoName} ${xml_branch} master Line=`sed -n '/name="device\/common/=' ${manifest}` echo $Line sed -i "$Line i\ <project name=\"${GerritRepoName}\" path=\"${LocalRepoName}\"/>" ${manifest} cd manifest/ git add manifest.xml git commit -sm "[author:$USER][add repository: $LocalRepoName ]" git push origin HEAD:refs/for/${xml_branch}
#!/bin/bash
if [ -d manifest ]; then
rm -rf manifest
fi
./AutoCreatRepo.sh $USER $GerritRepoName $LocalRepoName $xml_branch