| 1 |
# t180 --- merge -p |
| 2 |
# |
| 3 |
# Copyright (C) 2010-2022 Thien-Thi Nguyen |
| 4 |
# |
| 5 |
# This program is free software: you can redistribute it and/or |
| 6 |
# modify it under the terms of the GNU General Public License as |
| 7 |
# published by the Free Software Foundation, either version 3 of |
| 8 |
# the License, or (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty |
| 12 |
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
# See the GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
. $srcdir/common |
| 19 |
split_std_out_err no |
| 20 |
|
| 21 |
## |
| 22 |
# Do "merge -p" on various input files, checking exit value, |
| 23 |
# stderr and stdout for conflicts and successful operations. |
| 24 |
## |
| 25 |
|
| 26 |
mout=$wd/m.out |
| 27 |
merr=$wd/m.err |
| 28 |
eout=$wd/e.out |
| 29 |
eerr=$wd/e.err |
| 30 |
|
| 31 |
a=$wd/a |
| 32 |
b=$wd/b |
| 33 |
c=$wd/c |
| 34 |
|
| 35 |
cat > $a <<EOF |
| 36 |
every time i work with RCS and pause |
| 37 |
to think of past sessions quick and slow |
| 38 |
time films thicker, lumpy, an unrent gauze. |
| 39 |
EOF |
| 40 |
|
| 41 |
cat > $b <<EOF |
| 42 |
a non-VAX uproc inside, can you believe it? |
| 43 |
to think of past sessions quick and slow |
| 44 |
it be all the same, what six letters permit. |
| 45 |
EOF |
| 46 |
|
| 47 |
cat > $c <<EOF |
| 48 |
a non-VAX uproc inside, can you believe it? |
| 49 |
first Rx000 then 21xxx, odd names both; |
| 50 |
it be all the same, what six letters permit. |
| 51 |
EOF |
| 52 |
|
| 53 |
try () |
| 54 |
{ |
| 55 |
# $1 -- expected exit value |
| 56 |
# $2 -- file1 |
| 57 |
# $3 -- file2 |
| 58 |
# $4 -- file3 |
| 59 |
# $5 -- expected stderr |
| 60 |
# $6 -- expected stdout |
| 61 |
ev=$1 |
| 62 |
if test "$5" |
| 63 |
then echo "$5" | sed 's/|$//' > $eerr |
| 64 |
else > $eerr |
| 65 |
fi |
| 66 |
echo "$6" | sed '1d;s/^|//;s/|$//' > $eout |
| 67 |
|
| 68 |
merge -p $2 $3 $4 1> $mout 2> $merr |
| 69 |
test $ev = $? || problem "unexpected exit value: merge -p $2 $3 $4" |
| 70 |
diff $eout $mout > $wd/diff.out |
| 71 |
noiselessness_rules $wd/diff.out "(stdout) $1 $2 $3" |
| 72 |
diff $eerr $merr > $wd/diff.out |
| 73 |
noiselessness_rules $wd/diff.out "(stderr) $1 $2 $3" |
| 74 |
} |
| 75 |
|
| 76 |
conflicts='merge: warning: conflicts during merge' |
| 77 |
|
| 78 |
|
| 79 |
try 1 $a $b $c "$conflicts" ' |
| 80 |
|<<<<<<< t180.d/a| |
| 81 |
|every time i work with RCS and pause| |
| 82 |
|to think of past sessions quick and slow| |
| 83 |
|time films thicker, lumpy, an unrent gauze.| |
| 84 |
|=======| |
| 85 |
|a non-VAX uproc inside, can you believe it?| |
| 86 |
|first Rx000 then 21xxx, odd names both;| |
| 87 |
|it be all the same, what six letters permit.| |
| 88 |
|>>>>>>> t180.d/c|' |
| 89 |
|
| 90 |
try 1 $a $c $b "$conflicts" ' |
| 91 |
|<<<<<<< t180.d/a| |
| 92 |
|every time i work with RCS and pause| |
| 93 |
|to think of past sessions quick and slow| |
| 94 |
|time films thicker, lumpy, an unrent gauze.| |
| 95 |
|=======| |
| 96 |
|a non-VAX uproc inside, can you believe it?| |
| 97 |
|to think of past sessions quick and slow| |
| 98 |
|it be all the same, what six letters permit.| |
| 99 |
|>>>>>>> t180.d/b|' |
| 100 |
|
| 101 |
try 1 $b $a $c "$conflicts" ' |
| 102 |
|<<<<<<< t180.d/b| |
| 103 |
|a non-VAX uproc inside, can you believe it?| |
| 104 |
|to think of past sessions quick and slow| |
| 105 |
|it be all the same, what six letters permit.| |
| 106 |
|=======| |
| 107 |
|a non-VAX uproc inside, can you believe it?| |
| 108 |
|first Rx000 then 21xxx, odd names both;| |
| 109 |
|it be all the same, what six letters permit.| |
| 110 |
|>>>>>>> t180.d/c|' |
| 111 |
|
| 112 |
try 1 $b $c $a "$conflicts" ' |
| 113 |
|<<<<<<< t180.d/b| |
| 114 |
|a non-VAX uproc inside, can you believe it?| |
| 115 |
|to think of past sessions quick and slow| |
| 116 |
|it be all the same, what six letters permit.| |
| 117 |
|=======| |
| 118 |
|every time i work with RCS and pause| |
| 119 |
|to think of past sessions quick and slow| |
| 120 |
|time films thicker, lumpy, an unrent gauze.| |
| 121 |
|>>>>>>> t180.d/a|' |
| 122 |
|
| 123 |
try 1 $c $a $b "$conflicts" ' |
| 124 |
|<<<<<<< t180.d/c| |
| 125 |
|a non-VAX uproc inside, can you believe it?| |
| 126 |
|first Rx000 then 21xxx, odd names both;| |
| 127 |
|it be all the same, what six letters permit.| |
| 128 |
|=======| |
| 129 |
|a non-VAX uproc inside, can you believe it?| |
| 130 |
|to think of past sessions quick and slow| |
| 131 |
|it be all the same, what six letters permit.| |
| 132 |
|>>>>>>> t180.d/b|' |
| 133 |
|
| 134 |
try 1 $c $b $a "$conflicts" ' |
| 135 |
|<<<<<<< t180.d/c| |
| 136 |
|a non-VAX uproc inside, can you believe it?| |
| 137 |
|first Rx000 then 21xxx, odd names both;| |
| 138 |
|it be all the same, what six letters permit.| |
| 139 |
|=======| |
| 140 |
|every time i work with RCS and pause| |
| 141 |
|to think of past sessions quick and slow| |
| 142 |
|time films thicker, lumpy, an unrent gauze.| |
| 143 |
|>>>>>>> t180.d/a|' |
| 144 |
|
| 145 |
try 0 $a $a $b '' ' |
| 146 |
|a non-VAX uproc inside, can you believe it?| |
| 147 |
|to think of past sessions quick and slow| |
| 148 |
|it be all the same, what six letters permit.|' |
| 149 |
|
| 150 |
try 0 $a $b $a '' ' |
| 151 |
|every time i work with RCS and pause| |
| 152 |
|to think of past sessions quick and slow| |
| 153 |
|time films thicker, lumpy, an unrent gauze.|' |
| 154 |
|
| 155 |
try 0 $a $a $c '' ' |
| 156 |
|a non-VAX uproc inside, can you believe it?| |
| 157 |
|first Rx000 then 21xxx, odd names both;| |
| 158 |
|it be all the same, what six letters permit.|' |
| 159 |
|
| 160 |
try 0 $a $c $a '' ' |
| 161 |
|every time i work with RCS and pause| |
| 162 |
|to think of past sessions quick and slow| |
| 163 |
|time films thicker, lumpy, an unrent gauze.|' |
| 164 |
|
| 165 |
## |
| 166 |
# Check that "merge -p -q" produces no conflict warnings. |
| 167 |
## |
| 168 |
|
| 169 |
merge -p -q $a $b $c 1>$mout 2>$merr \ |
| 170 |
&& problem '‘merge -p -q’ succeeded' |
| 171 |
silence_means_death $mout 'merge -p -q' |
| 172 |
noiselessness_rules $merr 'merge -p -q' |
| 173 |
|
| 174 |
exit 0 |
| 175 |
|
| 176 |
# t180 ends here |