chiark / gitweb /
72c749d5b389dcbf8fa95817880ff67a13992ace
[topbloke.git] / topbloke-merge-driver
1 #!/bin/sh
2 set -e
3
4 fail () { echo >&2 "$0: $*"; exit 127; }
5
6 case "$1" in
7 --v1) how=tip ;;
8 --v1-base) how=base ;;
9 --v1-dep) how=dep ;;
10 *) fail "bad usage" ;;
11 esac
12
13 whichfile=$1
14 ancestor=$2
15 current=$3
16 other=$4
17 markersize=$5
18
19 case $on.$whichfile in
20 dep.msg|dep.deps|dep.flags)
21         touch "$current"
22         exit 0
23         ;;
24 base.msg|base.deps)
25         echo '# not applicable' >"$current"
26         exit 0
27         ;;
28 base.flags)
29         exec topbloke-merge-lists -UDeleted "$current" "$ancestor" "$other"
30         ;;
31 tip.msg)
32         exec git-merge-file --marker-size=$markersize \
33                 "$current" "$ancestor" "$other"
34         ;;
35 tip.deps|tip.flags|*.included|*.pflags)
36         exec topbloke-merge-lists "$current" "$ancestor" "$other"
37         ;;
38 *)
39         fail "huh $on $whichfile ?"
40         ;;
41 esac