annotate tests/test-merge-tools @ 7757:af6a63438a8a

identify: have consistent output for local repositories Also, add some extensive testing for it (hardly any in the suite so far).
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Fri, 13 Feb 2009 11:32:33 +0100
parents 737f274d1915
children 8c06d4bf2c23
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7731
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
1 #!/bin/sh
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
2
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
3 # test merge-tools configuration - mostly exercising filemerge.py
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
4
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
5 unset HGMERGE # make sure HGMERGE doesn't interfere with the test
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
6
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
7 hg init
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
8
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
9 echo "# revision 0"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
10 echo "revision 0" > f
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
11 echo "space" >> f
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
12 hg commit -Am "revision 0" -d "1000000 0"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
13
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
14 echo "# revision 1"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
15 echo "revision 1" > f
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
16 echo "space" >> f
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
17 hg commit -Am "revision 1" -d "1000000 0"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
18
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
19 hg update 0 > /dev/null
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
20 echo "# revision 2"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
21 echo "revision 2" > f
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
22 echo "space" >> f
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
23 hg commit -Am "revision 2" -d "1000000 0"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
24
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
25 hg update 0 > /dev/null
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
26 echo "# revision 3 - simple to merge"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
27 echo "revision 3" >> f
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
28 hg commit -Am "revision 3" -d "1000000 0"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
29
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
30
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
31 echo "[merge-tools]" > .hg/hgrc
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
32 echo
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
33
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
34 beforemerge() {
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
35 cat .hg/hgrc
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
36 echo "# hg update -C 1"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
37 hg update -C 1 > /dev/null
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
38 }
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
39
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
40 aftermerge() {
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
41 echo "# cat f"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
42 cat f
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
43 echo "# hg stat"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
44 hg stat
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
45 rm -f f.orig
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
46 echo
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
47 }
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
48
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
49 domerge() {
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
50 beforemerge
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
51 echo "# hg merge $*"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
52 hg merge $*
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
53 aftermerge
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
54 }
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
55
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
56 echo
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
57 echo Tool selection
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
58 echo
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
59
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
60 echo "# default is internal merge:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
61 domerge -r 2
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
62
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
63 echo "# simplest hgrc using false for merge:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
64 echo "false.whatever=" >> .hg/hgrc
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
65 domerge -r 2
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
66
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
67 echo "# true with higher .priority gets precedence:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
68 echo "true.priority=1" >> .hg/hgrc
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
69 domerge -r 2
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
70
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
71 echo "# unless lowered on command line:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
72 domerge -r 2 --config merge-tools.true.priority=-7
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
73
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
74 echo "# or false set higher on command line:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
75 domerge -r 2 --config merge-tools.false.priority=117
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
76
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
77 echo "# or true.executable not found in PATH:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
78 domerge -r 2 --config merge-tools.true.executable=nonexistingmergetool
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
79
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
80 echo "# or true.executable with bogus path:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
81 domerge -r 2 --config merge-tools.true.executable=/bin/nonexistingmergetool
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
82
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
83 echo "# but true.executable set to cat found in PATH works:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
84 echo "true.executable=cat" >> .hg/hgrc
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
85 domerge -r 2
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
86
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
87 echo "# and true.executable set to cat with path works:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
88 domerge -r 2 --config merge-tools.true.executable=/bin/cat
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
89
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
90
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
91 echo
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
92 echo Tool selection and merge-patterns
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
93 echo
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
94
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
95 echo "# merge-patterns specifies new tool tac:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
96 domerge -r 2 --config merge-patterns.f=tac
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
97
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
98 echo "# merge-patterns specifies executable not found in PATH and gets warning:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
99 domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
100
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
101 echo "# merge-patterns specifies executable with bogus path and gets warning:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
102 domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/bin/nonexistingmergetool
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
103
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
104
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
105 echo
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
106 echo Premerge
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
107 echo
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
108
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
109 echo "# Default is silent simplemerge:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
110 domerge -r 3
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
111
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
112 echo "# .premerge=True is same:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
113 domerge -r 3 --config merge-tools.true.premerge=True
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
114
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
115 echo "# .premerge=False executes merge-tool:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
116 domerge -r 3 --config merge-tools.true.premerge=False
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
117
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
118
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
119 echo
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
120 echo Tool execution
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
121 echo
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
122
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
123 echo '# set tools.args explicit to include $base $local $other $output:' # default '$local $base $other'
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
124 beforemerge
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
125 hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
126 | sed 's,==> .* <==,==> ... <==,g'
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
127 aftermerge
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
128
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
129 echo '# Merge with "echo mergeresult > $local":'
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
130 beforemerge
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
131 hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
132 aftermerge
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
133
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
134 echo '# - and $local is the file f:'
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
135 beforemerge
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
136 hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
137 aftermerge
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
138
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
139 echo '# Merge with "echo mergeresult > $output" - the variable is a bit magic:'
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
140 beforemerge
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
141 hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
142 aftermerge
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
143
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
144
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
145 echo
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
146 echo Merge post-processing
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
147 echo
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
148
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
149 echo "# cat is a bad merge-tool and doesn't change:"
737f274d1915 test-merge-tools
Mads Kiilerich <mads@kiilerich.com>
parents:
diff changeset
150 domerge -r 2 --config merge-tools.true.checkchanged=1