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