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 18 |
---|
26 | #------------------------------------------------------------------------------- |
---|
27 | setup |
---|
28 | init_repos |
---|
29 | init_branch ctrl $REPOS_URL |
---|
30 | init_branch_wc ren_ed $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: rename, edit, discard local |
---|
36 | TEST_KEY=$TEST_KEY_BASE-discard |
---|
37 | svn switch -q $ROOT_URL/branches/dev/Share/ctrl |
---|
38 | svn rename -q pro/hello.pro pro/hello.pro.renamed |
---|
39 | svn commit -q -m "Renamed conflict file (local)" |
---|
40 | svn update -q |
---|
41 | echo "Local contents (1)" >>pro/hello.pro.renamed |
---|
42 | svn commit -q -m "Modified conflict file (local)" |
---|
43 | svn update -q |
---|
44 | svn switch -q $ROOT_URL/branches/dev/Share/ren_ed |
---|
45 | echo "Merge contents (1)" >>pro/hello.pro |
---|
46 | svn commit -q -m "Modified conflict file (merge)" |
---|
47 | svn update -q |
---|
48 | svn switch -q $ROOT_URL/branches/dev/Share/ctrl |
---|
49 | fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ed >/dev/null |
---|
50 | if [[ $SVN_MINOR_VERSION == "1.14" ]]; then |
---|
51 | run_pass "$TEST_KEY" fcm conflicts <<__IN__ |
---|
52 | y |
---|
53 | __IN__ |
---|
54 | else |
---|
55 | run_pass "$TEST_KEY" fcm conflicts <<__IN__ |
---|
56 | n |
---|
57 | __IN__ |
---|
58 | fi |
---|
59 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
60 | #IF SVN1.8/9/10 [info] pro/hello.pro: in tree conflict. |
---|
61 | #IF SVN1.14 [info] pro/hello.pro.renamed: in text conflict. |
---|
62 | #IF SVN1.8/9/10 Locally: renamed to pro/hello.pro.renamed. |
---|
63 | #IF SVN1.8/9/10 Externally: edited. |
---|
64 | #IF SVN1.8/9/10 Answer (y) to accept the local rename. |
---|
65 | #IF SVN1.8/9/10 Answer (n) to keep the file. |
---|
66 | #IF SVN1.8/9/10 You can then merge in changes. |
---|
67 | #IF SVN1.8/9/10 Keep the local version? |
---|
68 | #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 |
---|
69 | #IF SVN1.14 diff3 $PWD/pro/hello.pro.renamed.3.tmp $PWD/pro/hello.pro.renamed.tmp $PWD/pro/hello.pro.renamed.2.tmp |
---|
70 | ==== |
---|
71 | 1:3c |
---|
72 | Local contents (1) |
---|
73 | 2:2a |
---|
74 | 3:3c |
---|
75 | Merge contents (1) |
---|
76 | #IF SVN1.8/9/10 A pro/hello.pro |
---|
77 | #IF SVN1.8/9/10 D pro/hello.pro.renamed |
---|
78 | #IF SVN1.8/9 Resolved conflicted state of 'pro/hello.pro' |
---|
79 | #IF SVN1.10 Tree conflict at 'pro/hello.pro' marked as resolved. |
---|
80 | #IF SVN1.14 Run "svn resolve --accept working pro/hello.pro.renamed"? |
---|
81 | #IF SVN1.14 Enter "y" or "n" (or just press <return> for "n") Merge conflicts in 'pro/hello.pro.renamed' marked as resolved. |
---|
82 | __OUT__ |
---|
83 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
84 | #------------------------------------------------------------------------------- |
---|
85 | # Tests fcm conflicts: rename, edit, discard local (status) |
---|
86 | TEST_KEY=$TEST_KEY_BASE-discard-status |
---|
87 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
88 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
89 | M . |
---|
90 | #IF SVN1.8/9/10 A + pro/hello.pro |
---|
91 | #IF SVN1.8/9/10 > moved from pro/hello.pro.renamed |
---|
92 | #IF SVN1.8/9/10 D pro/hello.pro.renamed |
---|
93 | #IF SVN1.8/9/10 > moved to pro/hello.pro |
---|
94 | #IF SVN1.14 M pro/hello.pro.renamed |
---|
95 | __OUT__ |
---|
96 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
97 | #------------------------------------------------------------------------------- |
---|
98 | # Tests fcm conflicts: rename, edit, discard local (cat) |
---|
99 | TEST_KEY=$TEST_KEY_BASE-discard-cat |
---|
100 | if [[ $SVN_MINOR_VERSION == "1.14" ]]; then |
---|
101 | run_pass "$TEST_KEY" cat pro/hello.pro.renamed |
---|
102 | else |
---|
103 | run_pass "$TEST_KEY" cat pro/hello.pro |
---|
104 | fi |
---|
105 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
106 | PRO HELLO |
---|
107 | END |
---|
108 | #IF SVN1.14 <<<<<<< .working |
---|
109 | Local contents (1) |
---|
110 | #IF SVN1.14 ||||||| .old |
---|
111 | #IF SVN1.14 ======= |
---|
112 | #IF SVN1.14 Merge contents (1) |
---|
113 | #IF SVN1.14 >>>>>>> .new |
---|
114 | __OUT__ |
---|
115 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
116 | #------------------------------------------------------------------------------- |
---|
117 | cd $TEST_DIR |
---|
118 | rm -rf $TEST_DIR/wc |
---|
119 | mkdir $TEST_DIR/wc |
---|
120 | svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc |
---|
121 | cd $TEST_DIR/wc |
---|
122 | #------------------------------------------------------------------------------- |
---|
123 | # Tests fcm conflicts: rename, edit, keep local |
---|
124 | TEST_KEY=$TEST_KEY_BASE-keep |
---|
125 | fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ed >/dev/null |
---|
126 | run_pass "$TEST_KEY" fcm conflicts <<__IN__ |
---|
127 | y |
---|
128 | __IN__ |
---|
129 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
130 | #IF SVN1.8/9/10 [info] pro/hello.pro: in tree conflict. |
---|
131 | #IF SVN1.14 [info] pro/hello.pro.renamed: in text conflict. |
---|
132 | #IF SVN1.8/9/10 Locally: renamed to pro/hello.pro.renamed. |
---|
133 | #IF SVN1.8/9/10 Externally: edited. |
---|
134 | #IF SVN1.8/9/10 Answer (y) to accept the local rename. |
---|
135 | #IF SVN1.8/9/10 Answer (n) to keep the file. |
---|
136 | #IF SVN1.8/9/10 You can then merge in changes. |
---|
137 | #IF SVN1.8/9/10 Keep the local version? |
---|
138 | #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 |
---|
139 | #IF SVN1.14 diff3 $PWD/pro/hello.pro.renamed.3.tmp $PWD/pro/hello.pro.renamed.tmp $PWD/pro/hello.pro.renamed.2.tmp |
---|
140 | ==== |
---|
141 | 1:3c |
---|
142 | Local contents (1) |
---|
143 | 2:2a |
---|
144 | 3:3c |
---|
145 | Merge contents (1) |
---|
146 | #IF SVN1.8/9 Resolved conflicted state of 'pro/hello.pro' |
---|
147 | #IF SVN1.10 Tree conflict at 'pro/hello.pro' marked as resolved. |
---|
148 | #IF SVN1.14 Run "svn resolve --accept working pro/hello.pro.renamed"? |
---|
149 | #IF SVN1.14 Enter "y" or "n" (or just press <return> for "n") Merge conflicts in 'pro/hello.pro.renamed' marked as resolved. |
---|
150 | __OUT__ |
---|
151 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
152 | #------------------------------------------------------------------------------- |
---|
153 | # Tests fcm conflicts: rename, edit, keep local (status) |
---|
154 | TEST_KEY=$TEST_KEY_BASE-keep-status |
---|
155 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
156 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
157 | M . |
---|
158 | #IF SVN1.14 M pro/hello.pro.renamed |
---|
159 | __OUT__ |
---|
160 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
161 | #------------------------------------------------------------------------------- |
---|
162 | # Tests fcm conflicts: rename, edit, keep local (cat) |
---|
163 | TEST_KEY=$TEST_KEY_BASE-keep-cat |
---|
164 | run_pass "$TEST_KEY" cat pro/hello.pro.renamed |
---|
165 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
166 | PRO HELLO |
---|
167 | END |
---|
168 | #IF SVN1.14 <<<<<<< .working |
---|
169 | Local contents (1) |
---|
170 | #IF SVN1.14 ||||||| .old |
---|
171 | #IF SVN1.14 ======= |
---|
172 | #IF SVN1.14 Merge contents (1) |
---|
173 | #IF SVN1.14 >>>>>>> .new |
---|
174 | __OUT__ |
---|
175 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
176 | teardown |
---|