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 | [[ $SVN_VERSION == "1.13.0" ]] && skip_all "Tests do not work with svn 1.13.0" |
---|
26 | tests 15 |
---|
27 | #------------------------------------------------------------------------------- |
---|
28 | setup |
---|
29 | init_repos |
---|
30 | init_branch ctrl $REPOS_URL |
---|
31 | init_branch_wc del_ren $REPOS_URL |
---|
32 | cd $TEST_DIR/wc |
---|
33 | #------------------------------------------------------------------------------- |
---|
34 | # Tests fcm conflicts: delete, rename, discard local |
---|
35 | TEST_KEY=$TEST_KEY_BASE-discard |
---|
36 | svn switch -q $ROOT_URL/branches/dev/Share/ctrl |
---|
37 | svn delete -q pro/hello.pro |
---|
38 | svn commit -q -m "Deleted conflict file (local)" |
---|
39 | svn update -q |
---|
40 | svn switch -q $ROOT_URL/branches/dev/Share/del_ren |
---|
41 | svn rename -q pro/hello.pro pro/hello.pro.renamed |
---|
42 | svn commit -q -m "Renamed conflict file (merge)" |
---|
43 | svn update -q |
---|
44 | echo "Merge changes (1)" >>pro/hello.pro.renamed |
---|
45 | svn commit -q -m "Modified conflict file (merge)" |
---|
46 | svn update -q |
---|
47 | svn switch -q $ROOT_URL/branches/dev/Share/ctrl |
---|
48 | fcm merge --non-interactive $ROOT_URL/branches/dev/Share/del_ren >/dev/null |
---|
49 | run_pass "$TEST_KEY" fcm conflicts <<__IN__ |
---|
50 | n |
---|
51 | __IN__ |
---|
52 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
53 | [info] pro/hello.pro: in tree conflict. |
---|
54 | Locally: deleted. |
---|
55 | Externally: renamed to pro/hello.pro.renamed. |
---|
56 | Answer (y) to accept the local delete. |
---|
57 | Answer (n) to accept the external rename. |
---|
58 | Keep the local version? |
---|
59 | #IF SVN1.8/9 Enter "y" or "n" (or just press <return> for "n") Resolved conflicted state of 'pro/hello.pro' |
---|
60 | #IF SVN1.10/14 Enter "y" or "n" (or just press <return> for "n") Tree conflict at 'pro/hello.pro' marked as resolved. |
---|
61 | __OUT__ |
---|
62 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
63 | #------------------------------------------------------------------------------- |
---|
64 | # Tests fcm conflicts: delete, rename, discard local (status) |
---|
65 | TEST_KEY=$TEST_KEY_BASE-discard-status |
---|
66 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
67 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
68 | M . |
---|
69 | A + pro/hello.pro.renamed |
---|
70 | __OUT__ |
---|
71 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
72 | #------------------------------------------------------------------------------- |
---|
73 | # Tests fcm conflicts: delete, rename, discard local (cat) |
---|
74 | TEST_KEY=$TEST_KEY_BASE-discard-cat |
---|
75 | run_pass "$TEST_KEY" cat pro/hello.pro.renamed |
---|
76 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
77 | PRO HELLO |
---|
78 | END |
---|
79 | Merge changes (1) |
---|
80 | __OUT__ |
---|
81 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
82 | #------------------------------------------------------------------------------- |
---|
83 | cd $TEST_DIR |
---|
84 | rm -rf $TEST_DIR/wc |
---|
85 | mkdir $TEST_DIR/wc |
---|
86 | svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc |
---|
87 | cd $TEST_DIR/wc |
---|
88 | #------------------------------------------------------------------------------- |
---|
89 | # Tests fcm conflicts: delete, rename, keep local |
---|
90 | TEST_KEY=$TEST_KEY_BASE-keep |
---|
91 | fcm merge --non-interactive $ROOT_URL/branches/dev/Share/del_ren >/dev/null |
---|
92 | run_pass "$TEST_KEY" fcm conflicts <<__IN__ |
---|
93 | y |
---|
94 | __IN__ |
---|
95 | file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
96 | [info] pro/hello.pro: in tree conflict. |
---|
97 | Locally: deleted. |
---|
98 | Externally: renamed to pro/hello.pro.renamed. |
---|
99 | Answer (y) to accept the local delete. |
---|
100 | Answer (n) to accept the external rename. |
---|
101 | Keep the local version? |
---|
102 | Enter "y" or "n" (or just press <return> for "n") Reverted 'pro/hello.pro.renamed' |
---|
103 | #IF SVN1.8/9 Resolved conflicted state of 'pro/hello.pro' |
---|
104 | #IF SVN1.10/14 Tree conflict at 'pro/hello.pro' marked as resolved. |
---|
105 | __OUT__ |
---|
106 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
107 | #------------------------------------------------------------------------------- |
---|
108 | # Tests fcm conflicts: delete, rename, keep local (status) |
---|
109 | TEST_KEY=$TEST_KEY_BASE-keep-status |
---|
110 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
111 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
112 | M . |
---|
113 | __OUT__ |
---|
114 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
115 | #------------------------------------------------------------------------------- |
---|