- split clone and pull operations

- clone now also creates local branches tracking origin
- basic status script added
This commit is contained in:
Michael Iedema 2014-03-24 17:23:46 +01:00
parent 3b4f14a3b4
commit 56595590f1
4 changed files with 110 additions and 16 deletions

44
clone.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
#
# Copyright 2014 Range Networks, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# See the COPYING file in the main directory for details.
#
sayAndDo () {
echo $@
eval $@
if [ $? -ne 0 ]; then
echo "# ERROR: command failed!"
exit 1
fi
}
for component in a53 CommonLibs openbts RRLP smqueue sqlite3 subscriberRegistry
do
if [ ! -d $component ]; then
echo "# cloning $component"
sayAndDo git clone --recursive git@github.com:RangeNetworks/$component.git
cd $component
for remote in `git branch -r | grep -v master `
do
sayAndDo git checkout --track $remote
done
sayAndDo git checkout master
sayAndDo git submodule foreach 'git checkout master'
cd ..
echo
fi
done

View File

@ -26,25 +26,16 @@ sayAndDo () {
fi fi
} }
cloneOrPull () { for component in a53 CommonLibs openbts RRLP smqueue sqlite3 subscriberRegistry
if [ ! -d $@ ]; then do
echo "# cloning $@" if [ -d $component ]; then
sayAndDo git clone --recursive git@github.com:RangeNetworks/$@.git echo "# pulling $component"
sayAndDo cd $@ cd $component
sayAndDo git submodule foreach 'git checkout master'
sayAndDo cd ..
else
echo "# pulling $@"
sayAndDo cd $@
sayAndDo git pull sayAndDo git pull
sayAndDo git submodule update --remote sayAndDo git submodule update --remote
sayAndDo git submodule foreach 'git checkout master' sayAndDo git submodule foreach 'git checkout master'
sayAndDo git submodule foreach 'git pull' sayAndDo git submodule foreach 'git pull'
sayAndDo cd .. cd ..
echo
fi fi
}
for component in a53 CommonLibs openbts RRLP smqueue sqlite3 subscriberRegistry
do
cloneOrPull $component
done done

View File

@ -93,6 +93,7 @@ if [ $ANSWER == "yes" ]; then
echo "# - pushing to origin..." echo "# - pushing to origin..."
sayAndDo git push origin --delete $OLDNAME sayAndDo git push origin --delete $OLDNAME
sayAndDo git push origin $NEWNAME sayAndDo git push origin $NEWNAME
sayAndDo git branch -D $NEWNAME
echo "# - restoring workspace branch..." echo "# - restoring workspace branch..."
sayAndDo git checkout $BOOKMARK sayAndDo git checkout $BOOKMARK
fi fi

58
state.sh Executable file
View File

@ -0,0 +1,58 @@
#!/bin/bash
#
# Copyright 2014 Range Networks, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# See the COPYING file in the main directory for details.
#
sayAndDo () {
echo $@
eval $@
if [ $? -ne 0 ]; then
echo "# ERROR: command failed!"
exit 1
fi
}
usage () {
echo "# usage: ./state.sh (branches, tags)"
exit 1
}
if [ -z "$1" ]; then
type=status
elif [ $1 == "branches" ]; then
type=branch
elif [ $1 == "tags" ]; then
type=tag
else
usage
fi
for component in a53 CommonLibs openbts RRLP smqueue sqlite3 subscriberRegistry
do
if [ -d $component ]; then
echo "########################################################################"
echo "# $component"
cd $component
if [ $type == "status" ]; then
git status
else
git $type
fi
cd ..
echo
fi
done