mirror of
https://github.com/schoebel/mars
synced 2024-12-18 21:05:09 +00:00
18fd90d538
Signed-off-by: Thomas Schoebel-Theuer <schoebel@bell.site>
67 lines
2.3 KiB
Bash
67 lines
2.3 KiB
Bash
#!/bin/bash
|
|
# Copyright 2010-2013 Frank Liepold / 1&1 Internet AG
|
|
#
|
|
# Email: frank.liepold@1und1.de
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# as published by the Free Software Foundation; either version 2
|
|
# 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 General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
#####################################################################
|
|
|
|
function checkout_mars_run
|
|
{
|
|
local dir
|
|
|
|
declare -A checkout_dirs
|
|
declare -A checkout_branches
|
|
declare -A checkout_tags
|
|
|
|
checkout_branches["$checkout_mars_src_directory"]="$checkout_mars_git_branch"
|
|
checkout_tags["$checkout_mars_src_directory"]="$checkout_mars_git_tag"
|
|
checkout_branches["$checkout_mars_kernel_src_directory"]="$checkout_mars_kernel_git_branch"
|
|
checkout_branches["$checkout_mars_contrib_src_directory"]="$checkout_mars_contrib_git_branch"
|
|
|
|
for dir in ${!checkout_branches[@]};do
|
|
if [ ! -d "$dir" ];then
|
|
echo " $BASH_SOURCE:$LINENO: checkout directory $dir not found"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
if (( checkout_mars_fetch_git_repository )); then
|
|
echo " $BASH_SOURCE:$LINENO: git fetch not implemented yet" >&2
|
|
exit 1
|
|
fi
|
|
local pwd=$(pwd) br tag
|
|
for dir in ${!checkout_branches[@]}; do
|
|
br=${checkout_branches["$dir"]}
|
|
tag=${checkout_tags["$dir"]}
|
|
lib_vmsg " checking out branch $br in $dir"
|
|
cd $dir || lib_exit 1
|
|
pwd
|
|
if git status | egrep 'modified:|new file' ; then
|
|
local stash_name="stash.$(date +'%Y%m%d%H%M')"
|
|
lib_vmsg " saving to stash $stash_name"
|
|
git stash save $stash_name
|
|
fi
|
|
# git fetch origin || lib_exit 1
|
|
git checkout $br || lib_exit 1
|
|
# git rebase remotes/origin/$br || lib_exit 1
|
|
if [ -n "$tag" ]; then
|
|
git checkout $tag || lib_exit 1
|
|
fi
|
|
done
|
|
}
|
|
|