comparison hgmerge @ 240:737c66b68290

Replace tkmerge with hgmerge -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Replace tkmerge with hgmerge hgmerge attempts to find and use merge, kdiff3, tkmerge, and diff+patch. hg will use hgmerge unless overridden with HGMERGE manifest hash: 9137a620df4b235e66343b0fd0dba87fe631546e -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCoRGrywK+sNU5EO8RAi2VAJ9bh97ChGJymP/p8rvCuyNAMnk1bQCgrIGP vYI6qlyWKQZ01ObUTAIg92o= =+mRH -----END PGP SIGNATURE-----
author mpm@selenic.com
date Fri, 03 Jun 2005 18:27:55 -0800
parents
children a2edb4481f19
comparison
equal deleted inserted replaced
239:75840796e8e2 240:737c66b68290
1 #!/bin/bash
2 #
3 # hgmerge - default merge helper for Mercurial
4 #
5 # This tries to find a way to do three-way merge on the current system.
6 # The result ought to end up in $1.
7
8 set -e # bail out quickly on failure
9
10 LOCAL=$1
11 BASE=$2
12 OTHER=$3
13
14 # Back up our file
15 cp $LOCAL $LOCAL.orig
16
17 # Attempt to do a non-interactive merge
18 if which merge > /dev/null ; then
19 if merge $LOCAL $BASE $OTHER 2> /dev/null; then
20 # success!
21 exit 0
22 fi
23 cp $LOCAL.orig $LOCAL
24 fi
25
26 # try using kdiff3, which is fairly nice
27 if which kdiff3 > /dev/null ; then
28 if kdiff3 --auto $BASE $LOCAL $OTHER -o $LOCAL ; then
29 exit 0
30 else
31 exit 1
32 fi
33 fi
34
35 # try using tkdiff, which is a bit less sophisticated
36 if which tkdiff > /dev/null ; then
37 if tkdiff $LOCAL $OTHER -a $BASE -o $LOCAL ; then
38 exit 0
39 else
40 exit 1
41 fi
42 fi
43
44 # Attempt to do a merge with $EDITOR
45 if which merge > /dev/null ; then
46 echo "conflicts detected in $LOCAL"
47 merge $LOCAL $BASE $OTHER 2>/dev/null || $EDITOR $LOCAL
48 fi
49
50 # attempt to manually merge with diff and patch
51 if which diff > /dev/null ; then
52 if which patch > /dev/null ; then
53 T=`mktemp`
54 diff -u $BASE $OTHER > $T
55 if patch $LOCAL < $T ; then
56 exit 0
57 else
58 $EDITOR $LOCAL $LOCAL.rej
59 fi
60 rm $T
61 exit 1
62 fi
63 fi
64
65 echo "hgmerge: unable to find merge, tkdiff, kdiff3, or diff+patch!"
66 exit 1
67
68