[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 12 |
---|
| 26 | #------------------------------------------------------------------------------- |
---|
| 27 | setup |
---|
| 28 | init_repos |
---|
| 29 | init_branch ctrl $REPOS_URL |
---|
| 30 | init_branch_wc del_del $REPOS_URL |
---|
| 31 | cd $TEST_DIR/wc |
---|
| 32 | #------------------------------------------------------------------------------- |
---|
| 33 | # Tests fcm conflicts: delete, delete, 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_del |
---|
| 40 | svn delete -q pro/hello.pro |
---|
| 41 | svn commit -q -m "Deleted conflict file (merge)" |
---|
| 42 | svn update -q |
---|
| 43 | svn switch -q $ROOT_URL/branches/dev/Share/ctrl |
---|
| 44 | fcm merge --non-interactive $ROOT_URL/branches/dev/Share/del_del >/dev/null |
---|
| 45 | run_pass "$TEST_KEY" fcm conflicts <<__IN__ |
---|
| 46 | n |
---|
| 47 | __IN__ |
---|
| 48 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
| 49 | [info] pro/hello.pro: in tree conflict. |
---|
| 50 | Locally: deleted. |
---|
| 51 | Externally: deleted. |
---|
| 52 | Answer (y) to accept the local delete. |
---|
| 53 | Answer (n) to accept the external delete. |
---|
| 54 | Keep the local version? |
---|
| 55 | Enter "y" or "n" (or just press <return> for "n") Resolved conflicted state of 'pro/hello.pro' |
---|
| 56 | __OUT__ |
---|
| 57 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 58 | #------------------------------------------------------------------------------- |
---|
| 59 | # Tests fcm conflicts: delete, delete, discard local (status) |
---|
| 60 | TEST_KEY=$TEST_KEY_BASE-discard-status |
---|
| 61 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
| 62 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
| 63 | M . |
---|
| 64 | __OUT__ |
---|
| 65 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 66 | #------------------------------------------------------------------------------- |
---|
| 67 | cd $TEST_DIR |
---|
| 68 | rm -rf $TEST_DIR/wc |
---|
| 69 | mkdir $TEST_DIR/wc |
---|
| 70 | svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc |
---|
| 71 | cd $TEST_DIR/wc |
---|
| 72 | #------------------------------------------------------------------------------- |
---|
| 73 | # Tests fcm conflicts: delete, delete, keep local |
---|
| 74 | TEST_KEY=$TEST_KEY_BASE-keep |
---|
| 75 | fcm merge --non-interactive $ROOT_URL/branches/dev/Share/del_del >/dev/null |
---|
| 76 | run_pass "$TEST_KEY" fcm conflicts <<__IN__ |
---|
| 77 | y |
---|
| 78 | __IN__ |
---|
| 79 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
| 80 | [info] pro/hello.pro: in tree conflict. |
---|
| 81 | Locally: deleted. |
---|
| 82 | Externally: deleted. |
---|
| 83 | Answer (y) to accept the local delete. |
---|
| 84 | Answer (n) to accept the external delete. |
---|
| 85 | Keep the local version? |
---|
| 86 | Enter "y" or "n" (or just press <return> for "n") Resolved conflicted state of 'pro/hello.pro' |
---|
| 87 | __OUT__ |
---|
| 88 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 89 | #------------------------------------------------------------------------------- |
---|
| 90 | # Tests fcm conflicts: delete, delete, keep local (status) |
---|
| 91 | TEST_KEY=$TEST_KEY_BASE-keep-status |
---|
| 92 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
| 93 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
| 94 | M . |
---|
| 95 | __OUT__ |
---|
| 96 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 97 | teardown |
---|
| 98 | #------------------------------------------------------------------------------- |
---|