##// END OF EJS Templates
Replace tkmerge with hgmerge...
mpm@selenic.com -
r240:737c66b6 default
parent child Browse files
Show More
@@ -0,0 +1,68 b''
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
@@ -19,10 +19,6 b' Setting up Mercurial:'
19 $ export PYTHONPATH=${HOME}/lib/python # add this to your .bashrc
19 $ export PYTHONPATH=${HOME}/lib/python # add this to your .bashrc
20 $ export PATH=${HOME}/bin:$PATH #
20 $ export PATH=${HOME}/bin:$PATH #
21
21
22 You'll also need to set up a tool to handle three-way merges:
23
24 $ export HGMERGE=tkmerge # customize this
25
26 And finally:
22 And finally:
27
23
28 $ hg # test installation, show help
24 $ hg # test installation, show help
@@ -981,8 +981,8 b' class localrepository:'
981 self.ui.debug("file %s: other %s ancestor %s\n" %
981 self.ui.debug("file %s: other %s ancestor %s\n" %
982 (fn, short(other), short(base)))
982 (fn, short(other), short(base)))
983
983
984 cmd = os.environ["HGMERGE"]
984 cmd = os.environ.get("HGMERGE", "hgmerge")
985 r = os.system("%s %s %s %s %s" % (cmd, a, b, c, fn))
985 r = os.system("%s %s %s %s" % (cmd, a, b, c))
986 if r:
986 if r:
987 self.ui.warn("merging %s failed!\n" % f)
987 self.ui.warn("merging %s failed!\n" % f)
988
988
@@ -29,4 +29,4 b" setup(name='mercurial',"
29 glob.glob('templates/map-*') +
29 glob.glob('templates/map-*') +
30 glob.glob('templates/*.tmpl'))],
30 glob.glob('templates/*.tmpl'))],
31 cmdclass = { 'install_data' : install_package_data },
31 cmdclass = { 'install_data' : install_package_data },
32 scripts=['hg'])
32 scripts=['hg', 'hgmerge'])
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now