- split clone and pull operations
- clone now also creates local branches tracking origin - basic status script added
This commit is contained in:
parent
3b4f14a3b4
commit
56595590f1
|
@ -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
|
|
@ -26,25 +26,16 @@ sayAndDo () {
|
|||
fi
|
||||
}
|
||||
|
||||
cloneOrPull () {
|
||||
if [ ! -d $@ ]; then
|
||||
echo "# cloning $@"
|
||||
sayAndDo git clone --recursive git@github.com:RangeNetworks/$@.git
|
||||
sayAndDo cd $@
|
||||
sayAndDo git submodule foreach 'git checkout master'
|
||||
sayAndDo cd ..
|
||||
else
|
||||
echo "# pulling $@"
|
||||
sayAndDo cd $@
|
||||
for component in a53 CommonLibs openbts RRLP smqueue sqlite3 subscriberRegistry
|
||||
do
|
||||
if [ -d $component ]; then
|
||||
echo "# pulling $component"
|
||||
cd $component
|
||||
sayAndDo git pull
|
||||
sayAndDo git submodule update --remote
|
||||
sayAndDo git submodule foreach 'git checkout master'
|
||||
sayAndDo git submodule foreach 'git pull'
|
||||
sayAndDo cd ..
|
||||
cd ..
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
for component in a53 CommonLibs openbts RRLP smqueue sqlite3 subscriberRegistry
|
||||
do
|
||||
cloneOrPull $component
|
||||
done
|
|
@ -93,6 +93,7 @@ if [ $ANSWER == "yes" ]; then
|
|||
echo "# - pushing to origin..."
|
||||
sayAndDo git push origin --delete $OLDNAME
|
||||
sayAndDo git push origin $NEWNAME
|
||||
sayAndDo git branch -D $NEWNAME
|
||||
echo "# - restoring workspace branch..."
|
||||
sayAndDo git checkout $BOOKMARK
|
||||
fi
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue