Fossil SCM

Re-enable and update merge5.test, which has been disabled since 2017.

danshearer 2026-11-27 22:39 UTC test-suite-new
Commit 9ffbfea17b83e76d205c2a83ac6621e875913c8016dabdacef3762e414a108dd
1 file changed +28 -16
+28 -16
--- test/merge5.test
+++ test/merge5.test
@@ -16,14 +16,10 @@
1616
############################################################################
1717
#
1818
# Tests of the "merge" command
1919
#
2020
21
-#test merge5-sqlite3-issue false knownBug
22
-test_skip "fossil sqlite3 --no-repository reacts badly to SQL dumped from\
23
-repositories created from fossil older than version 2.0."
24
-
2521
# Verify the results of a check-out
2622
#
2723
proc checkout-test {testid expected_content} {
2824
set flist {}
2925
foreach {status filename} [exec $::fossilexe ls -l] {
@@ -46,10 +42,14 @@
4642
4743
# Construct a test repository
4844
#
4945
exec $::fossilexe sqlite3 --no-repository m5.fossil \
5046
<$testfiledir/${testfile}_repo.sql
47
+# The SQL is a dump of a repository from 2010, whose config table has no
48
+# mtime column, and "fossil rebuild" writes to config.mtime.
49
+exec $::fossilexe sqlite3 --no-repository m5.fossil \
50
+ "ALTER TABLE config ADD COLUMN mtime INTEGER;"
5151
fossil rebuild m5.fossil
5252
fossil open m5.fossil
5353
fossil user default drh --user drh
5454
fossil update baseline
5555
checkout-test 10 {
@@ -209,39 +209,51 @@
209209
6e167b139c294bed560e2e30b352361b101e1f39 four.txt
210210
64a8a5c7320fccfa4b2e5dfc5fd20a5381a86c5b three.txt
211211
b262fee89ed8a27a23a5e09d3917e0bebe22cd24 two.txt
212212
}
213213
214
-# Branches br1 and br4 both add file four.txt. So if we merge them together,
215
-# the version of file four.txt in the original should be preserved.
214
+# Branches br1 and br4 both add file four.txt, and their common ancestor
215
+# does not have it. A merge of one into the other is a three-way merge
216
+# of four.txt with an empty file as the ancestor, so it reports one merge
217
+# conflict and puts conflict marks in four.txt.
216218
#
219
+proc conflict-test {testid} {
220
+ global RESULT
221
+ set reported [string match "*WARNING: 1 merge conflicts*" $RESULT]
222
+ test merge5-$testid-reported $reported
223
+ set flist {}
224
+ foreach {status filename} [exec $::fossilexe ls -l] {
225
+ if {$status!="DELETED"} {lappend flist $filename}
226
+ }
227
+ test merge5-$testid-files {[lsort $flist] eq "four.txt three.txt two.txt"}
228
+ set four [read_file four.txt]
229
+ set marked [string match "*BEGIN MERGE CONFLICT*END MERGE CONFLICT*" $four]
230
+ test merge5-$testid-marked $marked
231
+ fossil sha1sum three.txt two.txt
232
+ set others [regsub -all {\n *} [string trim $RESULT] "\n"]
233
+ set expected "ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt"
234
+ append expected "\n278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt"
235
+ test merge5-$testid-others {$others eq $expected}
236
+}
217237
fossil update br1
218238
checkout-test 120 {
219239
35815cf5804e8933eab64ae34e00bbb381be72c5 four.txt
220240
da5c8346496f3421cb58f84b6e59e9531d9d424d one.txt
221241
ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt
222242
278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt
223243
}
224244
fossil merge br4 -expectError
225
-checkout-test 121 {
226
- 35815cf5804e8933eab64ae34e00bbb381be72c5 four.txt
227
- ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt
228
- 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt
229
-}
245
+conflict-test 121
230246
fossil undo
231247
fossil update br4
232248
checkout-test 122 {
233249
6e167b139c294bed560e2e30b352361b101e1f39 four.txt
234250
ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt
235251
278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt
236252
}
237253
fossil merge br1 -expectError
238
-checkout-test 123 {
239
- 6e167b139c294bed560e2e30b352361b101e1f39 four.txt
240
- ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt
241
- 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt
242
-}
254
+conflict-test 123
243255
fossil undo
244256
245257
# Merge br5 (which includes a file rename) into chng3
246258
#
247259
fossil update chng3
248260
--- test/merge5.test
+++ test/merge5.test
@@ -16,14 +16,10 @@
16 ############################################################################
17 #
18 # Tests of the "merge" command
19 #
20
21 #test merge5-sqlite3-issue false knownBug
22 test_skip "fossil sqlite3 --no-repository reacts badly to SQL dumped from\
23 repositories created from fossil older than version 2.0."
24
25 # Verify the results of a check-out
26 #
27 proc checkout-test {testid expected_content} {
28 set flist {}
29 foreach {status filename} [exec $::fossilexe ls -l] {
@@ -46,10 +42,14 @@
46
47 # Construct a test repository
48 #
49 exec $::fossilexe sqlite3 --no-repository m5.fossil \
50 <$testfiledir/${testfile}_repo.sql
 
 
 
 
51 fossil rebuild m5.fossil
52 fossil open m5.fossil
53 fossil user default drh --user drh
54 fossil update baseline
55 checkout-test 10 {
@@ -209,39 +209,51 @@
209 6e167b139c294bed560e2e30b352361b101e1f39 four.txt
210 64a8a5c7320fccfa4b2e5dfc5fd20a5381a86c5b three.txt
211 b262fee89ed8a27a23a5e09d3917e0bebe22cd24 two.txt
212 }
213
214 # Branches br1 and br4 both add file four.txt. So if we merge them together,
215 # the version of file four.txt in the original should be preserved.
 
 
216 #
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217 fossil update br1
218 checkout-test 120 {
219 35815cf5804e8933eab64ae34e00bbb381be72c5 four.txt
220 da5c8346496f3421cb58f84b6e59e9531d9d424d one.txt
221 ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt
222 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt
223 }
224 fossil merge br4 -expectError
225 checkout-test 121 {
226 35815cf5804e8933eab64ae34e00bbb381be72c5 four.txt
227 ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt
228 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt
229 }
230 fossil undo
231 fossil update br4
232 checkout-test 122 {
233 6e167b139c294bed560e2e30b352361b101e1f39 four.txt
234 ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt
235 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt
236 }
237 fossil merge br1 -expectError
238 checkout-test 123 {
239 6e167b139c294bed560e2e30b352361b101e1f39 four.txt
240 ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt
241 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt
242 }
243 fossil undo
244
245 # Merge br5 (which includes a file rename) into chng3
246 #
247 fossil update chng3
248
--- test/merge5.test
+++ test/merge5.test
@@ -16,14 +16,10 @@
16 ############################################################################
17 #
18 # Tests of the "merge" command
19 #
20
 
 
 
 
21 # Verify the results of a check-out
22 #
23 proc checkout-test {testid expected_content} {
24 set flist {}
25 foreach {status filename} [exec $::fossilexe ls -l] {
@@ -46,10 +42,14 @@
42
43 # Construct a test repository
44 #
45 exec $::fossilexe sqlite3 --no-repository m5.fossil \
46 <$testfiledir/${testfile}_repo.sql
47 # The SQL is a dump of a repository from 2010, whose config table has no
48 # mtime column, and "fossil rebuild" writes to config.mtime.
49 exec $::fossilexe sqlite3 --no-repository m5.fossil \
50 "ALTER TABLE config ADD COLUMN mtime INTEGER;"
51 fossil rebuild m5.fossil
52 fossil open m5.fossil
53 fossil user default drh --user drh
54 fossil update baseline
55 checkout-test 10 {
@@ -209,39 +209,51 @@
209 6e167b139c294bed560e2e30b352361b101e1f39 four.txt
210 64a8a5c7320fccfa4b2e5dfc5fd20a5381a86c5b three.txt
211 b262fee89ed8a27a23a5e09d3917e0bebe22cd24 two.txt
212 }
213
214 # Branches br1 and br4 both add file four.txt, and their common ancestor
215 # does not have it. A merge of one into the other is a three-way merge
216 # of four.txt with an empty file as the ancestor, so it reports one merge
217 # conflict and puts conflict marks in four.txt.
218 #
219 proc conflict-test {testid} {
220 global RESULT
221 set reported [string match "*WARNING: 1 merge conflicts*" $RESULT]
222 test merge5-$testid-reported $reported
223 set flist {}
224 foreach {status filename} [exec $::fossilexe ls -l] {
225 if {$status!="DELETED"} {lappend flist $filename}
226 }
227 test merge5-$testid-files {[lsort $flist] eq "four.txt three.txt two.txt"}
228 set four [read_file four.txt]
229 set marked [string match "*BEGIN MERGE CONFLICT*END MERGE CONFLICT*" $four]
230 test merge5-$testid-marked $marked
231 fossil sha1sum three.txt two.txt
232 set others [regsub -all {\n *} [string trim $RESULT] "\n"]
233 set expected "ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt"
234 append expected "\n278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt"
235 test merge5-$testid-others {$others eq $expected}
236 }
237 fossil update br1
238 checkout-test 120 {
239 35815cf5804e8933eab64ae34e00bbb381be72c5 four.txt
240 da5c8346496f3421cb58f84b6e59e9531d9d424d one.txt
241 ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt
242 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt
243 }
244 fossil merge br4 -expectError
245 conflict-test 121
 
 
 
 
246 fossil undo
247 fossil update br4
248 checkout-test 122 {
249 6e167b139c294bed560e2e30b352361b101e1f39 four.txt
250 ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt
251 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt
252 }
253 fossil merge br1 -expectError
254 conflict-test 123
 
 
 
 
255 fossil undo
256
257 # Merge br5 (which includes a file rename) into chng3
258 #
259 fossil update chng3
260

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button