add branch parameter
This commit is contained in:
parent
98eddc7b64
commit
c6e57c9475
@ -109,26 +109,33 @@ fi
|
|||||||
|
|
||||||
# See if repo exits in git
|
# See if repo exits in git
|
||||||
if [ $DEBUG ] ; then echo "check if $REPO_NAME in $ORG_NAME exists on $GITEAHOST" ; fi
|
if [ $DEBUG ] ; then echo "check if $REPO_NAME in $ORG_NAME exists on $GITEAHOST" ; fi
|
||||||
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME")
|
BRANCHES=
|
||||||
|
if [ $BRANCH ] ; then $BRANCHES="/branches/${BRANCH#*=}" ; file
|
||||||
|
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME$BRANCHES")
|
||||||
if [ "$RESPONSE" == "200" ]; then
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME exists!" ; fi
|
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME exists!" ; fi
|
||||||
else
|
else
|
||||||
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME does not exist" ; fi
|
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME does not exist" ; fi
|
||||||
while true; do
|
if [ $BRANCH ] ; then
|
||||||
read -p "Do you wish to run git-cvs2git?(y/n) " yn
|
echo "Can't find the ${BRANCH#*=} branch of $ORG_NAME/$REPO_NAME - exiting"
|
||||||
case $yn in
|
exit 1
|
||||||
[Yy]* )
|
else
|
||||||
if [ $DEBUG ] ; then echo "running git-cvs2git.sh" ; fi
|
while true; do
|
||||||
logname="git-cvs2git-create-$ORG_NAME-$REPO_NAME-$(date +'%FT%H%M').log"
|
read -p "Do you wish to run git-cvs2git?(y/n) " yn
|
||||||
git-cvs2git.sh "$REPO_NAME" "$ORG_NAME" > $logname
|
case $yn in
|
||||||
break;;
|
[Yy]* )
|
||||||
[Nn]* ) exit;;
|
if [ $DEBUG ] ; then echo "running git-cvs2git.sh" ; fi
|
||||||
* ) echo "Please answer yes or no.";;
|
logname="git-cvs2git-create-$ORG_NAME-$REPO_NAME-$(date +'%FT%H%M').log"
|
||||||
esac
|
git-cvs2git.sh "$REPO_NAME" "$ORG_NAME" > $logname
|
||||||
done
|
break;;
|
||||||
|
[Nn]* ) exit;;
|
||||||
|
* ) echo "Please answer yes or no.";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
# And check it is now there
|
# And check it is now there
|
||||||
if [ $DEBUG ] ; then echo "check if $REPO_NAME in $ORG_NAME exists on $GITEAHOST" ; fi
|
if [ $DEBUG ] ; then echo "check if $REPO_NAME in $ORG_NAME exists on $GITEAHOST" ; fi
|
||||||
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME")
|
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME$BRANCHES")
|
||||||
if [ "$RESPONSE" == "200" ]; then
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME created sucessfully!" ; fi
|
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME created sucessfully!" ; fi
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user