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" (text conflict following merge). |
---|
21 | #------------------------------------------------------------------------------- |
---|
22 | . $(dirname $0)/test_header |
---|
23 | #------------------------------------------------------------------------------- |
---|
24 | check_svn_version |
---|
25 | tests 11 |
---|
26 | #------------------------------------------------------------------------------- |
---|
27 | setup |
---|
28 | init_repos |
---|
29 | init_merge_branches merge1 merge2 $REPOS_URL |
---|
30 | cd $TEST_DIR/wc |
---|
31 | #------------------------------------------------------------------------------- |
---|
32 | TEST_KEY=$TEST_KEY_BASE-merge |
---|
33 | export SVN_EDITOR="sed -i 1i\foo" |
---|
34 | echo "The End" >> lib/python/info/poems.py |
---|
35 | svn commit -m "Finish off the poem" -q |
---|
36 | svn update -q |
---|
37 | run_pass "$TEST_KEY" fcm merge --non-interactive $ROOT_URL/branches/dev/Share/merge1 |
---|
38 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
39 | #------------------------------------------------------------------------------- |
---|
40 | TEST_KEY=$TEST_KEY_BASE-merge-status |
---|
41 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
42 | status_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
43 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<'__OUT__' |
---|
44 | M . |
---|
45 | ? lib/python/info/poems.py.merge-left.r1 |
---|
46 | ? lib/python/info/poems.py.merge-right.r5 |
---|
47 | ? lib/python/info/poems.py.working |
---|
48 | ? unversioned_file |
---|
49 | A + added_directory |
---|
50 | A + added_file |
---|
51 | A + module/tree_conflict_file |
---|
52 | C lib/python/info/poems.py |
---|
53 | M module/hello_constants.f90 |
---|
54 | M module/hello_constants.inc |
---|
55 | M module/hello_constants_dummy.inc |
---|
56 | M subroutine/hello_sub_dummy.h |
---|
57 | Summary of conflicts: |
---|
58 | Text conflicts: 1 |
---|
59 | __OUT__ |
---|
60 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
61 | #------------------------------------------------------------------------------- |
---|
62 | TEST_KEY=$TEST_KEY_BASE-merge-conflicts |
---|
63 | export FCM_GRAPHIC_MERGE=fcm-dummy-diff |
---|
64 | run_pass "$TEST_KEY" fcm conflicts <<'__IN__' |
---|
65 | y |
---|
66 | y |
---|
67 | __IN__ |
---|
68 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
69 | [info] lib/python/info/poems.py: in text conflict. |
---|
70 | diff3 $PWD/lib/python/info/poems.py.working $PWD/lib/python/info/poems.py.merge-left.r1 $PWD/lib/python/info/poems.py.merge-right.r5 |
---|
71 | ====3 |
---|
72 | 1:1,2c |
---|
73 | 2:1,2c |
---|
74 | #!/usr/bin/env python |
---|
75 | # -*- coding: utf-8 -*- |
---|
76 | 3:0a |
---|
77 | ====3 |
---|
78 | 1:6c |
---|
79 | 2:6c |
---|
80 | It needs a doctor for its eyes, |
---|
81 | 3:4c |
---|
82 | It needs a doctor FOR its eyes, |
---|
83 | ====3 |
---|
84 | 1:8,9c |
---|
85 | 2:8,9c |
---|
86 | However, if you feel inclined |
---|
87 | To get one (to improve your mind, |
---|
88 | 3:6,8c |
---|
89 | However, if you feel INclINed |
---|
90 | To get one ( |
---|
91 | to improve your mINd, |
---|
92 | ====3 |
---|
93 | 1:12c |
---|
94 | 2:12c |
---|
95 | And when it flies into a rage |
---|
96 | 3:11c |
---|
97 | And when it flies INto a rage |
---|
98 | ====3 |
---|
99 | 1:14c |
---|
100 | 2:14c |
---|
101 | I had an aunt in Yucatan |
---|
102 | 3:13c |
---|
103 | I had an aunt IN Yucatan |
---|
104 | ====3 |
---|
105 | 1:16c |
---|
106 | 2:16c |
---|
107 | And kept it for a pet. |
---|
108 | 3:15c |
---|
109 | And kept it FOR a pet. |
---|
110 | ====3 |
---|
111 | 1:19c |
---|
112 | 2:19c |
---|
113 | The Snake is living yet. |
---|
114 | 3:18c |
---|
115 | The Snake is livINg yet. |
---|
116 | ==== |
---|
117 | 1:24,25c |
---|
118 | print "\n", __doc__ |
---|
119 | The End |
---|
120 | 2:24c |
---|
121 | print "\n", __doc__ |
---|
122 | 3:23c |
---|
123 | prINt "\n", __doc__ |
---|
124 | Run "svn resolve --accept working lib/python/info/poems.py"? |
---|
125 | #IF SVN1.8/9 Enter "y" or "n" (or just press <return> for "n") Resolved conflicted state of 'lib/python/info/poems.py' |
---|
126 | #IF SVN1.10/14 Enter "y" or "n" (or just press <return> for "n") Merge conflicts in 'lib/python/info/poems.py' marked as resolved. |
---|
127 | __OUT__ |
---|
128 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
129 | #------------------------------------------------------------------------------- |
---|
130 | TEST_KEY=$TEST_KEY_BASE-merge-conflicts-status |
---|
131 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
132 | status_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
133 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<'__OUT__' |
---|
134 | M . |
---|
135 | ? unversioned_file |
---|
136 | A + added_directory |
---|
137 | A + added_file |
---|
138 | A + module/tree_conflict_file |
---|
139 | M lib/python/info/poems.py |
---|
140 | M module/hello_constants.f90 |
---|
141 | M module/hello_constants.inc |
---|
142 | M module/hello_constants_dummy.inc |
---|
143 | M subroutine/hello_sub_dummy.h |
---|
144 | __OUT__ |
---|
145 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|