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