add 4-04 check on repo delete
This commit is contained in:
parent
08f624fd4d
commit
51551534f1
@ -2,7 +2,10 @@
|
|||||||
#
|
#
|
||||||
# $1 = Module name e.g. smeserver-ddclient
|
# $1 = Module name e.g. smeserver-ddclient
|
||||||
# $2 = Organisation (smeserver or smecontrib)e
|
# $2 = Organisation (smeserver or smecontrib)e
|
||||||
# $3 = "local" will use parameters set for local repository else it will use remote
|
# optional (can be in any order)
|
||||||
|
# <local> will use parameters set for local repository else it will use remote
|
||||||
|
# <debug> turn on debug regardless of ~/.smegit/config
|
||||||
|
# <noisy> print a line showing how it was called
|
||||||
# This works whether the repo and local files exist of not (it deletes them if necessary)
|
# This works whether the repo and local files exist of not (it deletes them if necessary)
|
||||||
# However if the remote repo exists, it preserves the README.md file so that edits are not lost
|
# However if the remote repo exists, it preserves the README.md file so that edits are not lost
|
||||||
# Also note: I have had difficulty deleting all the link files in the source tree!
|
# Also note: I have had difficulty deleting all the link files in the source tree!
|
||||||
@ -12,12 +15,6 @@ if [[ -z $1 ]] ; then
|
|||||||
echo "************git-cvs2git.sh <modulename> <organization> [<local>]"
|
echo "************git-cvs2git.sh <modulename> <organization> [<local>]"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
clear
|
|
||||||
echo "**************************************************************************************************"
|
|
||||||
echo "* *"
|
|
||||||
echo "* SMEServer - git-cvs2git $1 $2 $3 `date` *"
|
|
||||||
echo "* *"
|
|
||||||
echo "**************************************************************************************************"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Pull in parameters from a config file ~/.smegit/config
|
# Pull in parameters from a config file ~/.smegit/config
|
||||||
@ -51,6 +48,32 @@ done < "$inifilename"
|
|||||||
DEBUG=
|
DEBUG=
|
||||||
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
||||||
|
|
||||||
|
GITEAUser=${remote_USER}
|
||||||
|
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
|
NOISY=
|
||||||
|
EXTRAPARAMS=
|
||||||
|
for param in $3 $4 $5 $6; do
|
||||||
|
if [ $param ] ; then
|
||||||
|
case $param in
|
||||||
|
local )
|
||||||
|
GITEAUser=${local_USER}
|
||||||
|
GITEAACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${local_GITEAHOST}
|
||||||
|
;;
|
||||||
|
debug )
|
||||||
|
DEBUG=true ;;
|
||||||
|
noisy )
|
||||||
|
NOISY=true ;;
|
||||||
|
* )
|
||||||
|
EXTRAPARAMS=$EXTRAPARAMS" "$param ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $NOISY ] ; then echo "git-cvs2git.sh $1 $2 $3 $4 $5 $6" ; fi
|
||||||
if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi
|
if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi
|
||||||
# Make this null if you want lots of output. Still quite a bit anyway
|
# Make this null if you want lots of output. Still quite a bit anyway
|
||||||
QUIET="-q"
|
QUIET="-q"
|
||||||
@ -73,16 +96,6 @@ else
|
|||||||
WORKDIR=${smegit_WORKDIR}
|
WORKDIR=${smegit_WORKDIR}
|
||||||
fi
|
fi
|
||||||
if [ $DEBUG ] ; then echo "WORKDIR=$WORKDIR" ; fi
|
if [ $DEBUG ] ; then echo "WORKDIR=$WORKDIR" ; fi
|
||||||
GITEAUser=${remote_USER}
|
|
||||||
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
|
||||||
GITEAHOST=${remote_GITEAHOST}
|
|
||||||
if [ $3 ] ; then
|
|
||||||
if [ $3 == "local" ] ; then
|
|
||||||
GITEAUser=${local_USER}
|
|
||||||
GITEAACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
|
||||||
GITEAHOST=${local_GITEAHOST}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
RemoteRepoURL="$GITEAHOST/$2/$1"
|
RemoteRepoURL="$GITEAHOST/$2/$1"
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -270,7 +283,7 @@ RESPONSE=$(curl "$checkSSL" "$curlsilent" -X 'DELETE' \
|
|||||||
"$GITEAHOST/api/v1/repos/$ORGGITEA/$1" \
|
"$GITEAHOST/api/v1/repos/$ORGGITEA/$1" \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H "Authorization: token $GITEAACCESSTOKEN")
|
-H "Authorization: token $GITEAACCESSTOKEN")
|
||||||
if [[ $RESPONSE == "204" ]] ; then
|
if [[ $RESPONSE == "204" || $RESPONSE == "404" ]] ; then
|
||||||
if [ $DEBUG ] ; then echo "************Repository $ORGGITEA/$1 deleted or does not exist" ; fi
|
if [ $DEBUG ] ; then echo "************Repository $ORGGITEA/$1 deleted or does not exist" ; fi
|
||||||
else
|
else
|
||||||
echo "************Can NOT delete Repository $ORGGITEA/$1 - results will be unknown - Aborting!"
|
echo "************Can NOT delete Repository $ORGGITEA/$1 - results will be unknown - Aborting!"
|
||||||
|
Loading…
Reference in New Issue
Block a user