File: git-test-debian-patches

package info (click to toggle)
mono 6.8.0.105%2Bdfsg-3.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,284,512 kB
  • sloc: cs: 11,172,132; xml: 2,850,069; ansic: 671,653; cpp: 122,091; perl: 59,366; javascript: 30,841; asm: 22,168; makefile: 20,093; sh: 15,020; python: 4,827; pascal: 925; sql: 859; sed: 16; php: 1
file content (42 lines) | stat: -rwxr-xr-x 1,885 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/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