gpush 934 Bytes
Newer Older
Vitaly Lipatov's avatar
Vitaly Lipatov committed
1 2 3 4 5 6 7 8
#!/bin/sh

# load common functions, compatible with local and installed script
#. `dirname $0`/../share/eterbuild/functions/common

#test -n "$SPECNAME" || SPECNAME=$(basename `pwd`).spec

if [ "$1" = "-h" ] ; then
9
	echo "gpush - publish current project repo to $GIRARHOST"
10
	echo "Use: gpush [project name] [target branch]"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
11 12 13
	exit 1
fi

14 15 16 17 18 19
# use as project name
if [ -n "$1" ] ; then
	PROJECTNAME=$1
else
	PROJECTNAME=$(basename `pwd`)
fi
Vitaly Lipatov's avatar
Vitaly Lipatov committed
20

21 22 23 24 25 26 27
CURRENTBRANCH=$(git branch | grep "^\*" | cut -d " " -f 2)

if [ -z "$CURRENTBRANCH" ] ; then
	echo "Can't detect current branch"
	exit 1
fi

28 29
# more correctly
CURRENTBRANCH=HEAD
30 31 32 33 34 35
# 
if [ -n "$2" ] ; then
	TARGETBRANCH=$CURRENTBRANCH:$2
else
	TARGETBRANCH=
fi
36

37 38
git push $@ $GIRARHOST:packages/$PROJECTNAME.git $TARGETBRANCH
git push --tags $GIRARHOST:packages/$PROJECTNAME.git $TARGETBRANCH
Vitaly Lipatov's avatar
Vitaly Lipatov committed
39 40

#> $ git commit -a; A='0.23-alt1'; git tag -s $A; \
41
#>   git tag -s -f -m 'Sisyphus release $A' sisyphus $A