~jamesodhunt/ubuntu/trusty/patch/bug-1306412

« back to all changes in this revision

Viewing changes to tests/merge

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2011-02-06 20:19:30 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110206201930-gxhup50tp3oee4wt
Tags: 2.6.1-1
* New upstream version.
  + Improved CR stripping heuristics. Closes: #484539
  + Fixes: creates files and directories instead of asking for the file
    location. Closes: #568248
* Remove lenny compatibility options -U --unified-reject-files and
 --global-reject-file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
# in any medium, are permitted without royalty provided the copyright
5
5
# notice and this notice are preserved.
6
6
 
7
 
# Test the --reject-format=FORMAT option
 
7
# Test the --merge option
8
8
 
9
9
. $srcdir/test-lib.sh
10
10
 
22
22
 
23
23
# ==============================================================
24
24
 
25
 
x() {
 
25
x2() {
26
26
    body=`seq 1 $1`
27
27
    shift
28
28
    echo "$body" > a
39
39
        shift
40
40
    done
41
41
    echo "$body" | sed$sed -e b > c
42
 
    output=`diff -u a b | patch $ARGS -f --merge c`
 
42
    output=`diff -u a b | patch $ARGS -f c`
43
43
    status=$?
44
44
    echo "$output" | sed -e '/^\(\|patching file c\)$/d'
45
45
    cat c
46
46
    test $status == 0 || echo "Status: $status"
47
47
}
48
48
 
 
49
x() {
 
50
    ARGS="$ARGS --merge" x2 "$@"
 
51
    echo
 
52
    ARGS="$ARGS --merge=diff3" x2 "$@"
 
53
}
 
54
 
49
55
unset ARGS
50
56
 
51
57
# ==============================================================
54
60
1
55
61
2
56
62
3
 
63
 
 
64
1
 
65
2
 
66
3
57
67
EOF
58
68
 
59
69
check 'x 3  2d' <<EOF
60
70
1
61
71
3
 
72
 
 
73
1
 
74
3
62
75
EOF
63
76
 
64
77
check 'x 2  2ib' <<EOF
65
78
1
66
79
b
67
80
2
 
81
 
 
82
1
 
83
b
 
84
2
68
85
EOF
69
86
 
70
87
check 'x 3  2ib -- 3ic' <<EOF
74
91
2
75
92
c
76
93
3
 
94
 
 
95
Hunk #1 merged at 2.
 
96
1
 
97
b
 
98
2
 
99
c
 
100
3
77
101
EOF
78
102
 
79
103
# ==============================================================
88
112
>>>>>>>
89
113
3
90
114
Status: 1
 
115
 
 
116
Hunk #1 NOT MERGED at 2-8.
 
117
1
 
118
<<<<<<<
 
119
2c
 
120
|||||||
 
121
2
 
122
=======
 
123
2b
 
124
>>>>>>>
 
125
3
 
126
Status: 1
91
127
EOF
92
128
 
93
129
check 'x 3  2d -- 2d' <<EOF
94
130
Hunk #1 already applied at 2.
95
131
1
96
132
3
 
133
 
 
134
Hunk #1 already applied at 2.
 
135
1
 
136
3
97
137
EOF
98
138
 
99
139
check 'x 2  2ibc -- 2ibc' <<EOF
101
141
1
102
142
bc
103
143
2
 
144
 
 
145
Hunk #1 already applied at 2.
 
146
1
 
147
bc
 
148
2
104
149
EOF
105
150
 
106
151
check 'x 4  2aa 2aa -- 2aa 2aa' <<EOF
111
156
a
112
157
3
113
158
4
 
159
 
 
160
Hunk #1 already applied at 3-4.
 
161
1
 
162
2
 
163
a
 
164
a
 
165
3
 
166
4
114
167
EOF
115
168
 
116
169
# ==============================================================
125
178
>>>>>>>
126
179
4
127
180
Status: 1
 
181
 
 
182
Hunk #1 NOT MERGED at 2-9.
 
183
1
 
184
<<<<<<<
 
185
2
 
186
|||||||
 
187
2
 
188
3
 
189
=======
 
190
3
 
191
>>>>>>>
 
192
4
 
193
Status: 1
128
194
EOF
129
195
 
130
196
check 'x 4  3d -- 2d' <<EOF
137
203
>>>>>>>
138
204
4
139
205
Status: 1
 
206
 
 
207
Hunk #1 NOT MERGED at 2-9.
 
208
1
 
209
<<<<<<<
 
210
3
 
211
|||||||
 
212
2
 
213
3
 
214
=======
 
215
2
 
216
>>>>>>>
 
217
4
 
218
Status: 1
140
219
EOF
141
220
 
142
221
# ==============================================================
151
230
>>>>>>>
152
231
3
153
232
Status: 1
 
233
 
 
234
Hunk #1 NOT MERGED at 2-8.
 
235
1
 
236
<<<<<<<
 
237
|||||||
 
238
2
 
239
=======
 
240
2
 
241
b
 
242
>>>>>>>
 
243
3
 
244
Status: 1
154
245
EOF
155
246
 
156
247
check 'x 3  2d -- 3ib' <<EOF
163
254
>>>>>>>
164
255
3
165
256
Status: 1
 
257
 
 
258
Hunk #1 NOT MERGED at 2-8.
 
259
1
 
260
<<<<<<<
 
261
2
 
262
b
 
263
|||||||
 
264
2
 
265
=======
 
266
>>>>>>>
 
267
3
 
268
Status: 1
166
269
EOF
167
270
 
168
271
# ==============================================================
169
272
 
 
273
# (Note that the output here differs from the diff3 output:
 
274
# patch does not have enough information to know that the "c"
 
275
# on the last line is part of the conflict.
 
276
 
170
277
check 'x 1  1cb -- 1cc' <<EOF
171
278
Hunk #1 NOT MERGED at 1-4.
172
279
<<<<<<<
175
282
>>>>>>>
176
283
c
177
284
Status: 1
 
285
 
 
286
Hunk #1 NOT MERGED at 1-6.
 
287
<<<<<<<
 
288
|||||||
 
289
1
 
290
=======
 
291
b
 
292
>>>>>>>
 
293
c
 
294
Status: 1
178
295
EOF
179
296
 
180
297
check 'x 4  2ca 3cb -- 2ca 3cc' <<EOF
188
305
>>>>>>>
189
306
4
190
307
Status: 1
 
308
 
 
309
Hunk #1 NOT MERGED at 2-11.
 
310
1
 
311
<<<<<<<
 
312
a
 
313
c
 
314
|||||||
 
315
2
 
316
3
 
317
=======
 
318
a
 
319
b
 
320
>>>>>>>
 
321
4
 
322
Status: 1
191
323
EOF
192
324
 
193
325
check 'x 6  3c3b 4c4b -- 3c3c 4c4c' <<EOF
204
336
5
205
337
6
206
338
Status: 1
 
339
 
 
340
Hunk #1 NOT MERGED at 3-12.
 
341
1
 
342
2
 
343
<<<<<<<
 
344
3c
 
345
4c
 
346
|||||||
 
347
3
 
348
4
 
349
=======
 
350
3b
 
351
4b
 
352
>>>>>>>
 
353
5
 
354
6
 
355
Status: 1
207
356
EOF
208
357
 
209
358
check 'x 4  2cb 3ca -- 2cc 3ca' <<EOF
217
366
a
218
367
4
219
368
Status: 1
 
369
 
 
370
Hunk #1 NOT MERGED at 2-11.
 
371
1
 
372
<<<<<<<
 
373
c
 
374
a
 
375
|||||||
 
376
2
 
377
3
 
378
=======
 
379
b
 
380
a
 
381
>>>>>>>
 
382
4
 
383
Status: 1
220
384
EOF
221
385
 
222
386
check 'x 3  2ib 3ib -- 2ic' <<EOF
231
395
b
232
396
3
233
397
Status: 1
 
398
 
 
399
Hunk #1 NOT MERGED at 2-7, merged at 9.
 
400
1
 
401
<<<<<<<
 
402
c
 
403
|||||||
 
404
=======
 
405
b
 
406
>>>>>>>
 
407
2
 
408
b
 
409
3
 
410
Status: 1
234
411
EOF
235
412
 
236
413
check 'x 3  2ib 3ib 3ib -- 2ic' <<EOF
246
423
b
247
424
3
248
425
Status: 1
 
426
 
 
427
Hunk #1 NOT MERGED at 2-7, merged at 9-10.
 
428
1
 
429
<<<<<<<
 
430
c
 
431
|||||||
 
432
=======
 
433
b
 
434
>>>>>>>
 
435
2
 
436
b
 
437
b
 
438
3
 
439
Status: 1
249
440
EOF
250
441
 
251
442
check 'x 9  4ca 5cb 6ca -- 4ca 5cc 6ca' <<EOF
264
455
8
265
456
9
266
457
Status: 1
 
458
 
 
459
Hunk #1 NOT MERGED at 4-16.
 
460
1
 
461
2
 
462
3
 
463
<<<<<<<
 
464
a
 
465
c
 
466
a
 
467
|||||||
 
468
4
 
469
5
 
470
6
 
471
=======
 
472
a
 
473
b
 
474
a
 
475
>>>>>>>
 
476
7
 
477
8
 
478
9
 
479
Status: 1
267
480
EOF
268
481
 
269
482
check 'x 3  2ib 3ib -- 1i0' <<EOF
273
486
2
274
487
b
275
488
3
 
489
 
 
490
0
 
491
1
 
492
b
 
493
2
 
494
b
 
495
3
276
496
EOF
277
497
 
278
498
check 'x 4  2ib 4ib -- 1i0 3ic' <<EOF
285
505
3
286
506
b
287
507
4
 
508
 
 
509
Hunk #1 merged at 3,7.
 
510
0
 
511
1
 
512
b
 
513
2
 
514
c
 
515
3
 
516
b
 
517
4
288
518
EOF
289
519
 
290
520
# ==============================================================
300
530
>>>>>>>
301
531
5
302
532
Status: 1
 
533
 
 
534
Hunk #1 NOT MERGED at 2-11.
 
535
1
 
536
<<<<<<<
 
537
2
 
538
3c
 
539
4
 
540
|||||||
 
541
2
 
542
3
 
543
4
 
544
=======
 
545
>>>>>>>
 
546
5
 
547
Status: 1
303
548
EOF
304
549
 
305
550
check 'x 5  3c3c -- 2,4d' <<EOF
313
558
>>>>>>>
314
559
5
315
560
Status: 1
 
561
 
 
562
Hunk #1 NOT MERGED at 2-11.
 
563
1
 
564
<<<<<<<
 
565
|||||||
 
566
2
 
567
3
 
568
4
 
569
=======
 
570
2
 
571
3c
 
572
4
 
573
>>>>>>>
 
574
5
 
575
Status: 1
316
576
EOF
317
577
 
318
578
# ==============================================================
327
587
>>>>>>>
328
588
3
329
589
Status: 1
 
590
 
 
591
Hunk #1 NOT MERGED at 1-9.
 
592
<<<<<<<
 
593
1
 
594
c
 
595
2
 
596
|||||||
 
597
1
 
598
2
 
599
=======
 
600
>>>>>>>
 
601
3
 
602
Status: 1
330
603
EOF
331
604
 
332
605
check 'x 3  2ic -- 1,2d' <<EOF
339
612
>>>>>>>
340
613
3
341
614
Status: 1
 
615
 
 
616
Hunk #1 NOT MERGED at 1-9.
 
617
<<<<<<<
 
618
|||||||
 
619
1
 
620
2
 
621
=======
 
622
1
 
623
c
 
624
2
 
625
>>>>>>>
 
626
3
 
627
Status: 1
342
628
EOF