aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/merge-all.sh
blob: 47541866459155844e6e6a7ebebab040046f15ca (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
FROM=$1
AUTOMERGE=$2
if [ "$FROM" = "" ]
then
	echo "Usage: $0 <from version> [automerge]"
	exit 3
fi
if [ "$AUTOMERGE" = "automerge" ]
then
	AUTOCOMMIT="autocommit"
fi

svn up
localchanges=`svn stat|wc -l`
if [ "$localchanges" != "0" ] && [ "$IGNOREDIRTY" != "ignoredirty" ]
then
	echo "You must have a clean working space copy"
	exit 4
fi

currentrepowithoutversion=`svn info|grep URL|sed "s/URL: //"|sed "s/\/[^\/]*$//"`
sourceurl="$currentrepowithoutversion/$FROM"
unmerged=`svn mergeinfo --show-revs eligible $sourceurl|sed "s/r//g"`

if [ "$unmerged" = "" ]
then
	echo "No changes to merge"
	exit 0
fi
echo "Unmerged changes"
echo "================"
for revision in $unmerged
do
	echo -n "[$revision] "
	svn log $sourceurl -r $revision --xml|grep "<msg>"|sed "s/<msg>//"|sed "s/<\/msg>//"
done

cmd=""
for revision in $unmerged
do
	thiscmd=`dirname $0`"/merge.sh $FROM $revision $AUTOCOMMIT $IGNOREDIRTY"
	cmd="$cmd $thiscmd && "
	if [ "$AUTOMERGE" = "automerge" ]
	then
		echo "Merging [$revision]..."
		$thiscmd
		if [ "$?" != "0" ]
		then
			echo "Merge of [$revision] failed, aborting..."
			exit 1
		fi
	fi
done
cmd="$cmd true"
if [ "$AUTOMERGE" != "automerge" ]
then
	echo
	echo "Merge command:"
	echo 
	echo $cmd
fi

exit 0