1 | #!/bin/bash |
---|
2 | # ------------------------------------------------------------------------------ |
---|
3 | # Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
4 | # |
---|
5 | # This file is part of FCM, tools for managing and building source code. |
---|
6 | # |
---|
7 | # FCM is free software: you can redistribute it and/or modify |
---|
8 | # it under the terms of the GNU General Public License as published by |
---|
9 | # the Free Software Foundation, either version 3 of the License, or |
---|
10 | # (at your option) any later version. |
---|
11 | # |
---|
12 | # FCM is distributed in the hope that it will be useful, |
---|
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | # GNU General Public License for more details. |
---|
16 | # |
---|
17 | # You should have received a copy of the GNU General Public License |
---|
18 | # along with FCM. If not, see <http://www.gnu.org/licenses/>. |
---|
19 | # ------------------------------------------------------------------------------ |
---|
20 | # Basic tests for "fcm conflicts" (tree conflict mode). |
---|
21 | #------------------------------------------------------------------------------- |
---|
22 | . $(dirname $0)/test_header |
---|
23 | #------------------------------------------------------------------------------- |
---|
24 | check_svn_version |
---|
25 | tests 24 |
---|
26 | #------------------------------------------------------------------------------- |
---|
27 | setup |
---|
28 | init_repos |
---|
29 | init_branch ctrl $REPOS_URL |
---|
30 | init_branch_wc ed_ren $REPOS_URL |
---|
31 | # Set a special (null) fcm-graphic-merge diff editor. |
---|
32 | export FCM_GRAPHIC_MERGE=fcm-dummy-diff |
---|
33 | cd $TEST_DIR/wc |
---|
34 | #------------------------------------------------------------------------------- |
---|
35 | # Tests fcm conflicts: edit, rename, discard local |
---|
36 | TEST_KEY=$TEST_KEY_BASE-discard |
---|
37 | svn switch -q $ROOT_URL/branches/dev/Share/ctrl |
---|
38 | echo "Local contents (1)" >>pro/hello.pro |
---|
39 | svn commit -q -m "Modified local copy of conflict file" |
---|
40 | svn update -q |
---|
41 | svn switch -q $ROOT_URL/branches/dev/Share/ed_ren |
---|
42 | echo "Merge contents (1)" >>pro/hello.pro |
---|
43 | svn rename -q pro/hello.pro pro/hello.pro.renamed |
---|
44 | svn commit -q -m "Modified and renamed merge copy of conflict file" |
---|
45 | svn update -q |
---|
46 | echo "Merge contents (2)" >>pro/hello.pro.renamed |
---|
47 | svn commit -q -m "Modified the merge copy of renamed conflict file" |
---|
48 | svn update -q |
---|
49 | svn switch -q $ROOT_URL/branches/dev/Share/ctrl |
---|
50 | fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ed_ren >/dev/null |
---|
51 | if [[ $SVN_MINOR_VERSION == "1.14" ]]; then |
---|
52 | run_pass "$TEST_KEY" fcm conflicts <<__IN__ |
---|
53 | y |
---|
54 | __IN__ |
---|
55 | else |
---|
56 | run_pass "$TEST_KEY" fcm conflicts <<__IN__ |
---|
57 | n |
---|
58 | __IN__ |
---|
59 | fi |
---|
60 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
61 | #IF SVN1.8/9/10 [info] pro/hello.pro: in tree conflict. |
---|
62 | #IF SVN1.14 [info] pro/hello.pro.renamed: in text conflict. |
---|
63 | #IF SVN1.8/9/10 Locally: edited. |
---|
64 | #IF SVN1.8/9/10 Externally: renamed to pro/hello.pro.renamed. |
---|
65 | #IF SVN1.8/9/10 Answer (y) to keep the file. |
---|
66 | #IF SVN1.8/9/10 Answer (n) to accept the external rename. |
---|
67 | #IF SVN1.8/9/10 You can then merge in changes. |
---|
68 | #IF SVN1.8/9/10 Keep the local version? |
---|
69 | #IF SVN1.8/9/10 Enter "y" or "n" (or just press <return> for "n") diff3 pro/hello.pro.renamed.working pro/hello.pro.renamed.merge-left.r1 pro/hello.pro.renamed.merge-right.r8 |
---|
70 | #IF SVN1.14 diff3 $PWD/pro/hello.pro.renamed.3.tmp $PWD/pro/hello.pro.renamed.tmp $PWD/pro/hello.pro.renamed.2.tmp |
---|
71 | ==== |
---|
72 | 1:3c |
---|
73 | Local contents (1) |
---|
74 | 2:2a |
---|
75 | 3:3,4c |
---|
76 | Merge contents (1) |
---|
77 | Merge contents (2) |
---|
78 | #IF SVN1.8/9/10 D pro/hello.pro |
---|
79 | #IF SVN1.14 Run "svn resolve --accept working pro/hello.pro.renamed"? |
---|
80 | #IF SVN1.14 Enter "y" or "n" (or just press <return> for "n") Merge conflicts in 'pro/hello.pro.renamed' marked as resolved. |
---|
81 | __OUT__ |
---|
82 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
83 | #------------------------------------------------------------------------------- |
---|
84 | # Tests fcm conflicts: edit, rename, discard local (status) |
---|
85 | TEST_KEY=$TEST_KEY_BASE-discard-status |
---|
86 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
87 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
88 | M . |
---|
89 | D pro/hello.pro |
---|
90 | #IF SVN1.14 > moved to pro/hello.pro.renamed |
---|
91 | A + pro/hello.pro.renamed |
---|
92 | #IF SVN1.14 > moved from pro/hello.pro |
---|
93 | __OUT__ |
---|
94 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
95 | #------------------------------------------------------------------------------- |
---|
96 | # Tests fcm conflicts: edit, rename, discard local (info) |
---|
97 | TEST_KEY=$TEST_KEY_BASE-discard-info |
---|
98 | run_pass "$TEST_KEY" svn info pro/hello.pro.renamed |
---|
99 | sed -i "/Date:\|Updated:\|UUID:\|Checksum\|Relative URL:\|Working Copy Root Path:/d" $TEST_DIR/"$TEST_KEY.out" |
---|
100 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
101 | Path: pro/hello.pro.renamed |
---|
102 | Name: hello.pro.renamed |
---|
103 | URL: $ROOT_URL/branches/dev/Share/ctrl/pro/hello.pro.renamed |
---|
104 | Repository Root: $REPOS_URL |
---|
105 | Revision: 8 |
---|
106 | Node Kind: file |
---|
107 | Schedule: add |
---|
108 | #IF SVN1.8/9/10 Copied From URL: $ROOT_URL/branches/dev/Share/ed_ren/pro/hello.pro.renamed |
---|
109 | #IF SVN1.14 Copied From URL: $ROOT_URL/branches/dev/Share/ctrl/pro/hello.pro |
---|
110 | Copied From Rev: 8 |
---|
111 | #IF SVN1.14 Moved From: pro/hello.pro |
---|
112 | Last Changed Author: $LOGNAME |
---|
113 | #IF SVN1.8/9/10 Last Changed Rev: 8 |
---|
114 | #IF SVN1.14 Last Changed Rev: 6 |
---|
115 | |
---|
116 | __OUT__ |
---|
117 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
118 | #------------------------------------------------------------------------------- |
---|
119 | # Tests fcm conflicts: delete, rename, discard local (cat) |
---|
120 | TEST_KEY=$TEST_KEY_BASE-discard-cat |
---|
121 | run_pass "$TEST_KEY" cat pro/hello.pro.renamed |
---|
122 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
123 | PRO HELLO |
---|
124 | END |
---|
125 | #IF SVN1.14 <<<<<<< .working |
---|
126 | #IF SVN1.14 Local contents (1) |
---|
127 | #IF SVN1.14 ||||||| .old |
---|
128 | #IF SVN1.14 ======= |
---|
129 | Merge contents (1) |
---|
130 | Merge contents (2) |
---|
131 | #IF SVN1.14 >>>>>>> .new |
---|
132 | __OUT__ |
---|
133 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
134 | #------------------------------------------------------------------------------- |
---|
135 | cd $TEST_DIR |
---|
136 | rm -rf $TEST_DIR/wc |
---|
137 | mkdir $TEST_DIR/wc |
---|
138 | svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc |
---|
139 | cd $TEST_DIR/wc |
---|
140 | #------------------------------------------------------------------------------- |
---|
141 | # Tests fcm conflicts: edit, rename, keep local |
---|
142 | TEST_KEY=$TEST_KEY_BASE-keep |
---|
143 | fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ed_ren >/dev/null |
---|
144 | run_pass "$TEST_KEY" fcm conflicts <<__IN__ |
---|
145 | y |
---|
146 | __IN__ |
---|
147 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
148 | #IF SVN1.8/9/10 [info] pro/hello.pro: in tree conflict. |
---|
149 | #IF SVN1.14 [info] pro/hello.pro.renamed: in text conflict. |
---|
150 | #IF SVN1.8/9/10 Locally: edited. |
---|
151 | #IF SVN1.8/9/10 Externally: renamed to pro/hello.pro.renamed. |
---|
152 | #IF SVN1.8/9/10 Answer (y) to keep the file. |
---|
153 | #IF SVN1.8/9/10 Answer (n) to accept the external rename. |
---|
154 | #IF SVN1.8/9/10 You can then merge in changes. |
---|
155 | #IF SVN1.8/9/10 Keep the local version? |
---|
156 | #IF SVN1.8/9/10 Enter "y" or "n" (or just press <return> for "n") diff3 pro/hello.pro.working pro/hello.pro.merge-left.r1 pro/hello.pro.merge-right.r8 |
---|
157 | #IF SVN1.14 diff3 $PWD/pro/hello.pro.renamed.3.tmp $PWD/pro/hello.pro.renamed.tmp $PWD/pro/hello.pro.renamed.2.tmp |
---|
158 | ==== |
---|
159 | 1:3c |
---|
160 | Local contents (1) |
---|
161 | 2:2a |
---|
162 | 3:3,4c |
---|
163 | Merge contents (1) |
---|
164 | Merge contents (2) |
---|
165 | #IF SVN1.8/9/10 Reverted 'pro/hello.pro.renamed' |
---|
166 | #IF SVN1.8/9 Resolved conflicted state of 'pro/hello.pro' |
---|
167 | #IF SVN1.10 Tree conflict at 'pro/hello.pro' marked as resolved. |
---|
168 | #IF SVN1.14 Run "svn resolve --accept working pro/hello.pro.renamed"? |
---|
169 | #IF SVN1.14 Enter "y" or "n" (or just press <return> for "n") Merge conflicts in 'pro/hello.pro.renamed' marked as resolved. |
---|
170 | __OUT__ |
---|
171 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
172 | #------------------------------------------------------------------------------- |
---|
173 | # Tests fcm conflicts: edit, rename, keep local (status) |
---|
174 | TEST_KEY=$TEST_KEY_BASE-keep-status |
---|
175 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
176 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
177 | M . |
---|
178 | #IF SVN1.14 D pro/hello.pro |
---|
179 | #IF SVN1.14 > moved to pro/hello.pro.renamed |
---|
180 | #IF SVN1.14 A + pro/hello.pro.renamed |
---|
181 | #IF SVN1.14 > moved from pro/hello.pro |
---|
182 | __OUT__ |
---|
183 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
184 | #------------------------------------------------------------------------------- |
---|
185 | # Tests fcm conflicts: edit, rename, keep local (info) |
---|
186 | TEST_KEY=$TEST_KEY_BASE-keep-info |
---|
187 | run_pass "$TEST_KEY" svn info pro/hello.pro |
---|
188 | sed -i "/Date:\|Updated:\|UUID:\|Checksum\|Relative URL:\|Working Copy Root Path:/d" $TEST_DIR/"$TEST_KEY.out" |
---|
189 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
190 | Path: pro/hello.pro |
---|
191 | Name: hello.pro |
---|
192 | URL: $ROOT_URL/branches/dev/Share/ctrl/pro/hello.pro |
---|
193 | Repository Root: $REPOS_URL |
---|
194 | Revision: 8 |
---|
195 | Node Kind: file |
---|
196 | #IF SVN1.8/9/10 Schedule: normal |
---|
197 | #IF SVN1.14 Schedule: delete |
---|
198 | #IF SVN1.14 Moved To: pro/hello.pro.renamed |
---|
199 | Last Changed Author: $LOGNAME |
---|
200 | Last Changed Rev: 6 |
---|
201 | |
---|
202 | __OUT__ |
---|
203 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
204 | #------------------------------------------------------------------------------- |
---|
205 | # Tests fcm conflicts: delete, rename, keep local (cat) |
---|
206 | TEST_KEY=$TEST_KEY_BASE-keep-cat |
---|
207 | if [[ $SVN_MINOR_VERSION == "1.14" ]]; then |
---|
208 | run_pass "$TEST_KEY" cat pro/hello.pro.renamed |
---|
209 | else |
---|
210 | run_pass "$TEST_KEY" cat pro/hello.pro |
---|
211 | fi |
---|
212 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
213 | PRO HELLO |
---|
214 | END |
---|
215 | #IF SVN1.14 <<<<<<< .working |
---|
216 | Local contents (1) |
---|
217 | #IF SVN1.14 ||||||| .old |
---|
218 | #IF SVN1.14 ======= |
---|
219 | #IF SVN1.14 Merge contents (1) |
---|
220 | #IF SVN1.14 Merge contents (2) |
---|
221 | #IF SVN1.14 >>>>>>> .new |
---|
222 | __OUT__ |
---|
223 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
224 | teardown |
---|
225 | #------------------------------------------------------------------------------- |
---|