e3d7b54ca3
Former-commit-id: bb0edac46772972b4c99a84b8e1791f43b9195f5
43 lines
1.8 KiB
Bash
Executable File
43 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
# Copyright (c) 2010 Mirco Bauer <meebey@debian.org>
|
|
#
|
|
# Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
|
|
#
|
|
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
CURRENT_BRANCH=$(git branch -l | egrep '^\* ' | cut -d ' ' -f 2)
|
|
UPSTREAM_BRANCH=$(grep -h upstream-branch $(git rev-parse --show-cdup)./debian/gbp.conf ~/.gbp.conf 2> /dev/null | head -n 1 | cut -d '=' -f 2)
|
|
DEBIAN_PATCHES=$(git branch -l | egrep "$CURRENT_BRANCH-patches/")
|
|
if [ ! -z $UPSTREAM_BRANCH ]; then
|
|
git checkout $UPSTREAM_BRANCH
|
|
if [ $? != 0 ]; then
|
|
echo "Failed to swtich to upstream branch: $UPSTREAM_BRANCH, bailing out...";
|
|
exit 1
|
|
fi
|
|
fi
|
|
for DEBIAN_PATCH in $DEBIAN_PATCHES; do
|
|
git merge --no-commit --no-ff $DEBIAN_PATCH > /dev/null 2>&1
|
|
if [ $? != 0 ]; then
|
|
echo "ERROR: Test merge of $DEBIAN_PATCH failed, branch needs update!"
|
|
else
|
|
DELTA=$(git diff --no-ext-diff HEAD | wc -l)
|
|
if [ $DELTA = 0 ]; then
|
|
echo "WARNING: delta of $DEBIAN_PATCH is 0! Patch already applied upstream, drop branch!"
|
|
fi
|
|
fi
|
|
git reset --hard > /dev/null
|
|
done
|
|
git checkout $CURRENT_BRANCH
|