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 | # Tree conflict: local file edit, incoming file replace upon merge |
---|
21 | #------------------------------------------------------------------------------- |
---|
22 | . "$(dirname "$0")/test_header" |
---|
23 | #------------------------------------------------------------------------------- |
---|
24 | check_svn_version |
---|
25 | tests 6 |
---|
26 | #------------------------------------------------------------------------------- |
---|
27 | setup |
---|
28 | init_repos |
---|
29 | init_branch replace "${REPOS_URL}" |
---|
30 | init_branch_wc edit "${REPOS_URL}" |
---|
31 | cd "${TEST_DIR}/wc" |
---|
32 | svn switch -q "${ROOT_URL}/branches/dev/Share/replace" |
---|
33 | HELLO="$(<'pro/hello.pro')" |
---|
34 | svn delete -q 'pro/hello.pro' |
---|
35 | svn commit -q -m 'Remove local copy of conflict file' |
---|
36 | echo 'Replace contents (1)' >'pro/hello.pro' |
---|
37 | svn add 'pro/hello.pro' |
---|
38 | svn commit -q -m 'Replace local copy of conflict file' |
---|
39 | svn switch -q "${ROOT_URL}/branches/dev/Share/edit" |
---|
40 | echo 'Merge contents (1)' >>'pro/hello.pro' |
---|
41 | svn commit -q -m 'Modified and renamed merge copy of conflict file' |
---|
42 | svn update -q |
---|
43 | #------------------------------------------------------------------------------- |
---|
44 | TEST_KEY="${TEST_KEY_BASE}-leip-y" |
---|
45 | fcm merge --non-interactive "${ROOT_URL}/branches/dev/Share/replace" >'/dev/null' |
---|
46 | run_pass "${TEST_KEY}" fcm conflicts <<<'y' |
---|
47 | sed -i "/^Resolved conflicted state of 'pro\/hello.pro'$/d" \ |
---|
48 | ${TEST_DIR}/"${TEST_KEY}.out" |
---|
49 | file_cmp "${TEST_KEY}.out" "${TEST_KEY}.out" <<'__OUT__' |
---|
50 | [info] pro/hello.pro: in tree conflict. |
---|
51 | Locally: edited. |
---|
52 | Externally: replaced. |
---|
53 | Answer (y) to keep the file. |
---|
54 | Answer (n) to accept the external replace. |
---|
55 | Keep the local version? |
---|
56 | Enter "y" or "n" (or just press <return> for "n") Resolved conflicted state of 'pro/hello.pro' |
---|
57 | __OUT__ |
---|
58 | file_cmp "${TEST_KEY}.err" "${TEST_KEY}.err" <'/dev/null' |
---|
59 | #------------------------------------------------------------------------------- |
---|
60 | TEST_KEY="${TEST_KEY_BASE}-leip-n" |
---|
61 | svn revert -R -q . |
---|
62 | rm '#commit_message#' |
---|
63 | fcm merge --non-interactive "${ROOT_URL}/branches/dev/Share/replace" >'/dev/null' |
---|
64 | run_pass "${TEST_KEY}" fcm conflicts <<<'n' |
---|
65 | sed -i "/^Resolved conflicted state of 'pro\/hello.pro'$/d" \ |
---|
66 | ${TEST_DIR}/"${TEST_KEY}.out" |
---|
67 | file_cmp "${TEST_KEY}.out" "${TEST_KEY}.out" <<'__OUT__' |
---|
68 | [info] pro/hello.pro: in tree conflict. |
---|
69 | Locally: edited. |
---|
70 | Externally: replaced. |
---|
71 | Answer (y) to keep the file. |
---|
72 | Answer (n) to accept the external replace. |
---|
73 | Keep the local version? |
---|
74 | Enter "y" or "n" (or just press <return> for "n") D pro/hello.pro |
---|
75 | A pro/hello.pro |
---|
76 | __OUT__ |
---|
77 | file_cmp "${TEST_KEY}.err" "${TEST_KEY}.err" <'/dev/null' |
---|
78 | #------------------------------------------------------------------------------- |
---|
79 | exit |
---|