source: tags/svn.1.5.4/SOURCE_TOOLS/arb_create_patch.sh

Last change on this file was 7919, checked in by westram, 13 years ago
  • keep & ignore latest_iwhite.patch
  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#!/bin/bash
2
3NAME=$1
4if [ -z "$NAME" ]; then
5    echo "Usage: arb_create_patch.sh name"
6    false
7else
8    if [ ! -d "$ARBHOME" ]; then
9        echo "No patch created (ARBHOME undefined)"
10    else
11        if [ ! -d $ARBHOME/.svn ]; then
12            echo "No patch created (no SVN checkout in ARBHOME)"
13        else
14            cd $ARBHOME
15            PATCHDIR=./patches.arb
16            mkdir -p $PATCHDIR
17            DATE=`date '+%Y%m%d_%H%M%S'`
18            PATCHNAME=${NAME}_$DATE
19            PATCH=$PATCHDIR/$PATCHNAME.patch
20            FAKEPATCH=$PATCHDIR/fake.patch
21            RECENT_PATCH=./latest.patch
22            INTERDIFF_PATCH=./interdiff.patch
23            IGNORE_WHITE_PATCH=./latest_iwhite.patch
24            WHITE_PATCH=./white.patch
25
26            svn diff > $PATCH
27           
28            if [ -e $PATCH ]; then
29                if [ ! -s $PATCH ]; then
30                    rm $PATCH
31                    if [ ! -e $FAKEPATCH ]; then
32                        echo "Index: No changes" > $FAKEPATCH
33                        echo "===================================================================" >> $FAKEPATCH
34                    fi
35                    ln --force $FAKEPATCH $RECENT_PATCH
36                    touch $FAKEPATCH
37                    echo "No patch generated (no diff)"
38                else
39                    DIFF=1
40                    INTER=0
41                    if [ -e $RECENT_PATCH ]; then
42                        DIFF=`diff $PATCH $RECENT_PATCH | wc -l`
43                        INTER=DIFF
44                    fi
45
46                    if [ $DIFF = 0 ]; then
47                        echo "No patch generated (same as last patch)"
48                        rm $PATCH
49                        rm -f $INTERDIFF_PATCH
50                    else
51                        (   svn diff -x -b > $IGNORE_WHITE_PATCH ; \
52                            interdiff $PATCH $IGNORE_WHITE_PATCH > $WHITE_PATCH ) &
53
54                        if [ $INTER != 0 ]; then
55                            interdiff -w $RECENT_PATCH $PATCH > $INTERDIFF_PATCH
56                        else
57                            rm -f $INTERDIFF_PATCH
58                        fi
59                        ln --force $PATCH $RECENT_PATCH
60                        ls -hog $PATCH $RECENT_PATCH
61                    fi
62                fi
63            fi
64        fi
65    fi
66fi
67
Note: See TracBrowser for help on using the repository browser.