author | Matt Mackall <mpm@selenic.com> |
Sun, 24 May 2009 02:56:14 -0500 | |
changeset 8576 | ec4ed21db4b2 |
parent 8539 | 9a4fe59b1eca |
child 8674 | 0941ee76489e |
permissions | -rwxr-xr-x |
7731 | 1 |
#!/bin/sh |
2 |
||
3 |
# test merge-tools configuration - mostly exercising filemerge.py |
|
4 |
||
5 |
unset HGMERGE # make sure HGMERGE doesn't interfere with the test |
|
6 |
||
7 |
hg init |
|
8 |
||
9 |
echo "# revision 0" |
|
10 |
echo "revision 0" > f |
|
11 |
echo "space" >> f |
|
12 |
hg commit -Am "revision 0" -d "1000000 0" |
|
13 |
||
14 |
echo "# revision 1" |
|
15 |
echo "revision 1" > f |
|
16 |
echo "space" >> f |
|
17 |
hg commit -Am "revision 1" -d "1000000 0" |
|
18 |
||
19 |
hg update 0 > /dev/null |
|
20 |
echo "# revision 2" |
|
21 |
echo "revision 2" > f |
|
22 |
echo "space" >> f |
|
23 |
hg commit -Am "revision 2" -d "1000000 0" |
|
24 |
||
25 |
hg update 0 > /dev/null |
|
26 |
echo "# revision 3 - simple to merge" |
|
27 |
echo "revision 3" >> f |
|
28 |
hg commit -Am "revision 3" -d "1000000 0" |
|
29 |
||
30 |
||
31 |
echo "[merge-tools]" > .hg/hgrc |
|
32 |
echo |
|
33 |
||
34 |
beforemerge() { |
|
35 |
cat .hg/hgrc |
|
36 |
echo "# hg update -C 1" |
|
37 |
hg update -C 1 > /dev/null |
|
38 |
} |
|
39 |
||
40 |
aftermerge() { |
|
41 |
echo "# cat f" |
|
42 |
cat f |
|
43 |
echo "# hg stat" |
|
44 |
hg stat |
|
45 |
rm -f f.orig |
|
46 |
echo |
|
47 |
} |
|
48 |
||
49 |
domerge() { |
|
50 |
beforemerge |
|
51 |
echo "# hg merge $*" |
|
52 |
hg merge $* |
|
53 |
aftermerge |
|
54 |
} |
|
55 |
||
56 |
echo |
|
57 |
echo Tool selection |
|
58 |
echo |
|
59 |
||
60 |
echo "# default is internal merge:" |
|
7785
660c8dd44060
test-merge-tool: Make sure no hgmerge can be found in $PATH
Mads Kiilerich <mads@kiilerich.com>
parents:
7769
diff
changeset
|
61 |
beforemerge |
660c8dd44060
test-merge-tool: Make sure no hgmerge can be found in $PATH
Mads Kiilerich <mads@kiilerich.com>
parents:
7769
diff
changeset
|
62 |
echo "# hg merge -r 2" |
660c8dd44060
test-merge-tool: Make sure no hgmerge can be found in $PATH
Mads Kiilerich <mads@kiilerich.com>
parents:
7769
diff
changeset
|
63 |
PATH=$BINDIR hg merge -r 2 |
660c8dd44060
test-merge-tool: Make sure no hgmerge can be found in $PATH
Mads Kiilerich <mads@kiilerich.com>
parents:
7769
diff
changeset
|
64 |
aftermerge |
7731 | 65 |
|
66 |
echo "# simplest hgrc using false for merge:" |
|
67 |
echo "false.whatever=" >> .hg/hgrc |
|
68 |
domerge -r 2 |
|
69 |
||
70 |
echo "# true with higher .priority gets precedence:" |
|
71 |
echo "true.priority=1" >> .hg/hgrc |
|
72 |
domerge -r 2 |
|
73 |
||
74 |
echo "# unless lowered on command line:" |
|
75 |
domerge -r 2 --config merge-tools.true.priority=-7 |
|
76 |
||
77 |
echo "# or false set higher on command line:" |
|
78 |
domerge -r 2 --config merge-tools.false.priority=117 |
|
79 |
||
80 |
echo "# or true.executable not found in PATH:" |
|
81 |
domerge -r 2 --config merge-tools.true.executable=nonexistingmergetool |
|
82 |
||
83 |
echo "# or true.executable with bogus path:" |
|
84 |
domerge -r 2 --config merge-tools.true.executable=/bin/nonexistingmergetool |
|
85 |
||
86 |
echo "# but true.executable set to cat found in PATH works:" |
|
87 |
echo "true.executable=cat" >> .hg/hgrc |
|
88 |
domerge -r 2 |
|
89 |
||
90 |
echo "# and true.executable set to cat with path works:" |
|
8539
9a4fe59b1eca
test-merge-tools: windows fixes
Patrick Mezard <pmezard@gmail.com>
parents:
7846
diff
changeset
|
91 |
domerge -r 2 --config merge-tools.true.executable=cat |
7731 | 92 |
|
93 |
echo |
|
94 |
echo Tool selection and merge-patterns |
|
95 |
echo |
|
96 |
||
7769
8c06d4bf2c23
test-merge-tools: Don't use tac
Mads Kiilerich <mads@kiilerich.com>
parents:
7731
diff
changeset
|
97 |
echo "# merge-patterns specifies new tool false:" |
8c06d4bf2c23
test-merge-tools: Don't use tac
Mads Kiilerich <mads@kiilerich.com>
parents:
7731
diff
changeset
|
98 |
domerge -r 2 --config merge-patterns.f=false |
7731 | 99 |
|
100 |
echo "# merge-patterns specifies executable not found in PATH and gets warning:" |
|
101 |
domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool |
|
102 |
||
103 |
echo "# merge-patterns specifies executable with bogus path and gets warning:" |
|
104 |
domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/bin/nonexistingmergetool |
|
105 |
||
7846
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
106 |
echo |
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
107 |
echo ui.merge overrules priority |
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
108 |
echo |
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
109 |
|
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
110 |
echo "# ui.merge specifies false:" |
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
111 |
domerge -r 2 --config ui.merge=false |
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
112 |
|
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
113 |
echo "# ui.merge specifies internal:fail:" |
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
114 |
domerge -r 2 --config ui.merge=internal:fail |
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
115 |
|
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
116 |
echo "# ui.merge specifies internal:local:" |
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
117 |
domerge -r 2 --config ui.merge=internal:local |
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
118 |
|
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
119 |
echo "# ui.merge specifies internal:other:" |
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
120 |
domerge -r 2 --config ui.merge=internal:other |
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
121 |
|
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
122 |
echo "# ui.merge specifies internal:other but is overruled by pattern for false:" |
1cb6836946be
test-merge-tools: test ui.merge functionality and selection of internal tools
Mads Kiilerich <mads@kiilerich.com>
parents:
7785
diff
changeset
|
123 |
domerge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false |
7731 | 124 |
|
125 |
echo |
|
126 |
echo Premerge |
|
127 |
echo |
|
128 |
||
129 |
echo "# Default is silent simplemerge:" |
|
130 |
domerge -r 3 |
|
131 |
||
132 |
echo "# .premerge=True is same:" |
|
133 |
domerge -r 3 --config merge-tools.true.premerge=True |
|
134 |
||
135 |
echo "# .premerge=False executes merge-tool:" |
|
136 |
domerge -r 3 --config merge-tools.true.premerge=False |
|
137 |
||
138 |
||
139 |
echo |
|
140 |
echo Tool execution |
|
141 |
echo |
|
142 |
||
143 |
echo '# set tools.args explicit to include $base $local $other $output:' # default '$local $base $other' |
|
144 |
beforemerge |
|
145 |
hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \ |
|
146 |
| sed 's,==> .* <==,==> ... <==,g' |
|
147 |
aftermerge |
|
148 |
||
149 |
echo '# Merge with "echo mergeresult > $local":' |
|
150 |
beforemerge |
|
151 |
hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local' |
|
152 |
aftermerge |
|
153 |
||
154 |
echo '# - and $local is the file f:' |
|
155 |
beforemerge |
|
156 |
hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f' |
|
157 |
aftermerge |
|
158 |
||
159 |
echo '# Merge with "echo mergeresult > $output" - the variable is a bit magic:' |
|
160 |
beforemerge |
|
161 |
hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output' |
|
162 |
aftermerge |
|
163 |
||
164 |
||
165 |
echo |
|
166 |
echo Merge post-processing |
|
167 |
echo |
|
168 |
||
169 |
echo "# cat is a bad merge-tool and doesn't change:" |
|
8539
9a4fe59b1eca
test-merge-tools: windows fixes
Patrick Mezard <pmezard@gmail.com>
parents:
7846
diff
changeset
|
170 |
domerge -y -r 2 --config merge-tools.true.checkchanged=1 |