chiark / gitweb /
891bfa4ca919c873240369881cff53e1e316473a
[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 ;;                # merge into tip from another tip of this patch
8 --v1-base) how=base ;;          # merge into tip from a base of this patch
9 --v1-dep) how=dep ;;            # merge into base from a dep's tip
10 *) fail "bad usage" ;;
11 esac
12
13 whichfile=$1
14 ancestor=$2
15 ours=$3
16 theirs=$4
17 markersize=$5
18
19 set -- "$ours" "$ancestor" "$theirs"
20
21 case $on.$whichfile in
22 dep.msg|dep.deps|dep.props)
23         touch "$ours"
24         ;;
25 base.msg)
26         echo '# not applicable' >"$ours"
27 base.deps)
28         echo >"$ours"
29         touch >"$ours"
30         ;;
31 base.props)
32         exec topbloke-merge-lists -M$markersize -P -UDeleted "$@"
33         ;;
34 tip.msg)
35         exec git-merge-file --marker-size=$markersize "$@"
36         ;;
37 tip.deps|*.included)
38         exec topbloke-merge-lists -M$markersize "$@"
39         ;;
40 tip.props|*.pprops)
41         exec topbloke-merge-lists -M$markersize -P "$@"
42         ;;
43 *)
44         fail "huh $on $whichfile ?"
45         ;;
46 esac