1 | #!/bin/bash |
---|
2 | # ------------------------------------------------------------------------------ |
---|
3 | # (C) British Crown Copyright 2006-17 Met Office. |
---|
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 merge". |
---|
21 | #------------------------------------------------------------------------------- |
---|
22 | . $(dirname $0)/test_header |
---|
23 | #------------------------------------------------------------------------------- |
---|
24 | check_svn_version |
---|
25 | tests 42 |
---|
26 | #------------------------------------------------------------------------------- |
---|
27 | setup |
---|
28 | init_repos |
---|
29 | init_merge_branches merge1 merge2 $REPOS_URL |
---|
30 | cd $TEST_DIR/wc |
---|
31 | #------------------------------------------------------------------------------- |
---|
32 | # Test the various mergeinfo output before merging. |
---|
33 | test_mergeinfo "$TEST_KEY_BASE-pre" \ |
---|
34 | $ROOT_URL/branches/dev/Share/merge1 - 9 <<__RESULTS__ |
---|
35 | begin-prop |
---|
36 | end-prop |
---|
37 | begin-info |
---|
38 | youngest common ancestor |
---|
39 | | last full merge |
---|
40 | | | tip of branch |
---|
41 | | | | repository path |
---|
42 | |
---|
43 | 1 9 |
---|
44 | | | |
---|
45 | --| |------------ branches/dev/Share/merge1 |
---|
46 | / |
---|
47 | / |
---|
48 | -------| |------------ trunk |
---|
49 | | |
---|
50 | WC |
---|
51 | end-info |
---|
52 | begin-eligible |
---|
53 | r5 |
---|
54 | end-eligible |
---|
55 | begin-merged |
---|
56 | end-merged |
---|
57 | __RESULTS__ |
---|
58 | #------------------------------------------------------------------------------- |
---|
59 | # Tests fcm merge --dry-run |
---|
60 | TEST_KEY=$TEST_KEY_BASE-dry-run |
---|
61 | export SVN_EDITOR="sed -i 1i\foo" |
---|
62 | run_pass "$TEST_KEY" fcm merge --dry-run $ROOT_URL/branches/dev/Share/merge1 |
---|
63 | merge_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
64 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__ |
---|
65 | Eligible merge(s) from /${PROJECT}branches/dev/Share/merge1@9: 5 |
---|
66 | -------------------------------------------------------------------------------- |
---|
67 | Merge: /${PROJECT}branches/dev/Share/merge1@5 |
---|
68 | c.f.: /${PROJECT}trunk@1 |
---|
69 | -------------------------------------------------------------------------dry-run |
---|
70 | --- Merging r4 through r5 into '.': |
---|
71 | A added_directory |
---|
72 | A added_directory/hello_constants.f90 |
---|
73 | A added_directory/hello_constants.inc |
---|
74 | A added_directory/hello_constants_dummy.inc |
---|
75 | A added_file |
---|
76 | A module/tree_conflict_file |
---|
77 | U lib/python/info/poems.py |
---|
78 | U module/hello_constants.f90 |
---|
79 | U module/hello_constants.inc |
---|
80 | U module/hello_constants_dummy.inc |
---|
81 | U subroutine/hello_sub_dummy.h |
---|
82 | -------------------------------------------------------------------------dry-run |
---|
83 | __OUT__ |
---|
84 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
85 | #------------------------------------------------------------------------------- |
---|
86 | # Tests svn status result of fcm merge --dry-run |
---|
87 | TEST_KEY=$TEST_KEY_BASE-dry-run-status |
---|
88 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
89 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
90 | ? unversioned_file |
---|
91 | __OUT__ |
---|
92 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
93 | #------------------------------------------------------------------------------- |
---|
94 | # Tests svn diff result of fcm merge --dry-run |
---|
95 | TEST_KEY=$TEST_KEY_BASE-dry-run-diff |
---|
96 | run_pass "$TEST_KEY" svn diff |
---|
97 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
98 | __OUT__ |
---|
99 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
100 | #------------------------------------------------------------------------------- |
---|
101 | # Tests fcm merge --non-interactive |
---|
102 | TEST_KEY=$TEST_KEY_BASE-non-interactive |
---|
103 | export SVN_EDITOR="sed -i 1i\foo" |
---|
104 | run_pass "$TEST_KEY" fcm merge --non-interactive $ROOT_URL/branches/dev/Share/merge1 |
---|
105 | merge_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
106 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__ |
---|
107 | Eligible merge(s) from /${PROJECT}branches/dev/Share/merge1@9: 5 |
---|
108 | -------------------------------------------------------------------------------- |
---|
109 | Merge: /${PROJECT}branches/dev/Share/merge1@5 |
---|
110 | c.f.: /${PROJECT}trunk@1 |
---|
111 | Merge succeeded. |
---|
112 | --------------------------------------------------------------------------actual |
---|
113 | --- Merging r4 through r5 into '.': |
---|
114 | A added_directory |
---|
115 | A added_directory/hello_constants.f90 |
---|
116 | A added_directory/hello_constants.inc |
---|
117 | A added_directory/hello_constants_dummy.inc |
---|
118 | A added_file |
---|
119 | A module/tree_conflict_file |
---|
120 | U lib/python/info/poems.py |
---|
121 | U module/hello_constants.f90 |
---|
122 | U module/hello_constants.inc |
---|
123 | U module/hello_constants_dummy.inc |
---|
124 | U subroutine/hello_sub_dummy.h |
---|
125 | --- Recording mergeinfo for merge of r4 through r5 into '.': |
---|
126 | U . |
---|
127 | --------------------------------------------------------------------------actual |
---|
128 | __OUT__ |
---|
129 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
130 | #------------------------------------------------------------------------------- |
---|
131 | # Tests svn status result of fcm merge --non-interactive |
---|
132 | TEST_KEY=$TEST_KEY_BASE-non-interactive-status |
---|
133 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
134 | status_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
135 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__ |
---|
136 | M . |
---|
137 | ? unversioned_file |
---|
138 | A + added_directory |
---|
139 | A + added_file |
---|
140 | A + module/tree_conflict_file |
---|
141 | M lib/python/info/poems.py |
---|
142 | M module/hello_constants.f90 |
---|
143 | M module/hello_constants.inc |
---|
144 | M module/hello_constants_dummy.inc |
---|
145 | M subroutine/hello_sub_dummy.h |
---|
146 | __OUT__ |
---|
147 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
148 | #------------------------------------------------------------------------------- |
---|
149 | # Tests svn diff result of fcm merge --non-interactive |
---|
150 | TEST_KEY=$TEST_KEY_BASE-non-interactive-diff |
---|
151 | run_pass "$TEST_KEY" svn diff |
---|
152 | diff_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
153 | diff_svn_version_filter >"$TEST_DIR/$TEST_KEY.sorted.ctrl" <<__OUT__ |
---|
154 | |
---|
155 | Index: . |
---|
156 | =================================================================== |
---|
157 | --- . (revision 9) |
---|
158 | +++ . (working copy) |
---|
159 | |
---|
160 | Property changes on: . |
---|
161 | ___________________________________________________________________ |
---|
162 | Added: svn:mergeinfo |
---|
163 | #IF SVN1.9 ## -0,0 +0,1 ## |
---|
164 | Merged /branches/dev/Share/merge1:r4-5 |
---|
165 | #IF SVN1.9 Index: added_directory/hello_constants.f90 |
---|
166 | #IF SVN1.9 =================================================================== |
---|
167 | #IF SVN1.9 Index: added_directory/hello_constants.inc |
---|
168 | #IF SVN1.9 =================================================================== |
---|
169 | #IF SVN1.9 Index: added_directory/hello_constants_dummy.inc |
---|
170 | #IF SVN1.9 =================================================================== |
---|
171 | #IF SVN1.9 Index: added_file |
---|
172 | #IF SVN1.9 =================================================================== |
---|
173 | Index: lib/python/info/poems.py |
---|
174 | =================================================================== |
---|
175 | --- lib/python/info/poems.py (revision 9) |
---|
176 | +++ lib/python/info/poems.py (working copy) |
---|
177 | @@ -1,24 +1,23 @@ |
---|
178 | -#!/usr/bin/env python |
---|
179 | -# -*- coding: utf-8 -*- |
---|
180 | """The Python, by Hilaire Belloc |
---|
181 | |
---|
182 | A Python I should not advise,-- |
---|
183 | -It needs a doctor for its eyes, |
---|
184 | +It needs a doctor FOR its eyes, |
---|
185 | And has the measles yearly. |
---|
186 | -However, if you feel inclined |
---|
187 | -To get one (to improve your mind, |
---|
188 | +However, if you feel INclINed |
---|
189 | +To get one ( |
---|
190 | +to improve your mINd, |
---|
191 | And not from fashion merely), |
---|
192 | Allow no music near its cage; |
---|
193 | -And when it flies into a rage |
---|
194 | +And when it flies INto a rage |
---|
195 | Chastise it, most severely. |
---|
196 | -I had an aunt in Yucatan |
---|
197 | +I had an aunt IN Yucatan |
---|
198 | Who bought a Python from a man |
---|
199 | -And kept it for a pet. |
---|
200 | +And kept it FOR a pet. |
---|
201 | She died, because she never knew |
---|
202 | These simple little rules and few;-- |
---|
203 | -The Snake is living yet. |
---|
204 | +The Snake is livINg yet. |
---|
205 | """ |
---|
206 | |
---|
207 | import this |
---|
208 | |
---|
209 | -print "\n", __doc__ |
---|
210 | +prINt "\n", __doc__ |
---|
211 | Index: module/hello_constants.f90 |
---|
212 | =================================================================== |
---|
213 | --- module/hello_constants.f90 (revision 9) |
---|
214 | +++ module/hello_constants.f90 (working copy) |
---|
215 | @@ -1,5 +1,5 @@ |
---|
216 | MODULE Hello_Constants |
---|
217 | |
---|
218 | -INCLUDE 'hello_constants_dummy.inc' |
---|
219 | +INCLUDE 'hello_constants_dummy.INc' |
---|
220 | |
---|
221 | END MODULE Hello_Constants |
---|
222 | Index: module/hello_constants.inc |
---|
223 | =================================================================== |
---|
224 | --- module/hello_constants.inc (revision 9) |
---|
225 | +++ module/hello_constants.inc (working copy) |
---|
226 | @@ -1 +1,2 @@ |
---|
227 | -CHARACTER (LEN=80), PARAMETER :: hello_string = 'Hello Earth!' |
---|
228 | +CHARACTER ( |
---|
229 | +LEN=80), PARAMETER :: hello_strINg = 'Hello Earth!!' |
---|
230 | Index: module/hello_constants_dummy.inc |
---|
231 | =================================================================== |
---|
232 | --- module/hello_constants_dummy.inc (revision 9) |
---|
233 | +++ module/hello_constants_dummy.inc (working copy) |
---|
234 | @@ -1 +1 @@ |
---|
235 | -INCLUDE 'hello_constants.inc' |
---|
236 | +INCLUDE 'hello_constants.INc' |
---|
237 | #IF SVN1.9 Index: module/tree_conflict_file |
---|
238 | #IF SVN1.9 =================================================================== |
---|
239 | Index: subroutine/hello_sub_dummy.h |
---|
240 | =================================================================== |
---|
241 | --- subroutine/hello_sub_dummy.h (revision 9) |
---|
242 | +++ subroutine/hello_sub_dummy.h (working copy) |
---|
243 | @@ -1 +1,2 @@ |
---|
244 | #include "hello_sub.h" |
---|
245 | +Modified a line |
---|
246 | __OUT__ |
---|
247 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" "$TEST_DIR/$TEST_KEY.sorted.ctrl" |
---|
248 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
249 | #------------------------------------------------------------------------------- |
---|
250 | # Test the various mergeinfo output after merging. |
---|
251 | test_mergeinfo "$TEST_KEY_BASE-post" \ |
---|
252 | $ROOT_URL/branches/dev/Share/merge1 - 9 <<__RESULTS__ |
---|
253 | begin-prop |
---|
254 | /branches/dev/Share/merge1:4-5 |
---|
255 | end-prop |
---|
256 | begin-info |
---|
257 | youngest common ancestor |
---|
258 | | last full merge |
---|
259 | | | tip of branch |
---|
260 | | | | repository path |
---|
261 | |
---|
262 | 1 9 |
---|
263 | | | |
---|
264 | --| |------------ branches/dev/Share/merge1 |
---|
265 | / |
---|
266 | / |
---|
267 | -------| |------------ trunk |
---|
268 | | |
---|
269 | WC |
---|
270 | end-info |
---|
271 | begin-eligible |
---|
272 | end-eligible |
---|
273 | begin-merged |
---|
274 | r4 |
---|
275 | r5 |
---|
276 | end-merged |
---|
277 | __RESULTS__ |
---|
278 | #------------------------------------------------------------------------------- |
---|
279 | teardown |
---|
280 | #------------------------------------------------------------------------------- |
---|