[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 18 |
---|
| 26 | #------------------------------------------------------------------------------- |
---|
| 27 | setup |
---|
| 28 | init_repos |
---|
| 29 | init_branch ctrl $REPOS_URL |
---|
| 30 | init_branch_wc ren_ren $REPOS_URL |
---|
| 31 | # Set a special (null) fcm-graphic-merge diff editor. |
---|
| 32 | export FCM_GRAPHIC_MERGE=fcm-dummy-diff |
---|
| 33 | cd $TEST_DIR/wc |
---|
| 34 | #------------------------------------------------------------------------------- |
---|
| 35 | # Tests fcm conflicts: rename, rename, diff rename, discard local |
---|
| 36 | TEST_KEY=$TEST_KEY_BASE-discard |
---|
| 37 | svn switch -q $ROOT_URL/branches/dev/Share/ctrl |
---|
| 38 | svn rename -q pro/hello.pro pro/hello.pro.renamed-local |
---|
| 39 | svn commit -q -m "Renamed conflict file (local)" |
---|
| 40 | svn update -q |
---|
| 41 | echo "Local contents (1)" >>pro/hello.pro.renamed-local |
---|
| 42 | svn commit -q -m "Modified conflict file (local)" |
---|
| 43 | svn update -q |
---|
| 44 | svn switch -q $ROOT_URL/branches/dev/Share/ren_ren |
---|
| 45 | echo "Merge contents (1)" >>pro/hello.pro |
---|
| 46 | svn commit -q -m "Modified conflict file (merge)" |
---|
| 47 | svn update -q |
---|
| 48 | svn rename -q pro/hello.pro pro/hello.pro.renamed-merge |
---|
| 49 | svn commit -q -m "Renamed conflict file (merge)" |
---|
| 50 | svn update -q |
---|
| 51 | svn switch -q $ROOT_URL/branches/dev/Share/ctrl |
---|
| 52 | fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ren >/dev/null |
---|
| 53 | run_pass "$TEST_KEY" fcm conflicts <<__IN__ |
---|
| 54 | n |
---|
| 55 | __IN__ |
---|
| 56 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
| 57 | [info] pro/hello.pro: in tree conflict. |
---|
| 58 | Locally: renamed to pro/hello.pro.renamed-local. |
---|
| 59 | Externally: renamed to pro/hello.pro.renamed-merge. |
---|
| 60 | Answer (y) to accept the local rename. |
---|
| 61 | Answer (n) to accept the external rename. |
---|
| 62 | You can then merge in changes. |
---|
| 63 | Keep the local version? |
---|
| 64 | Enter "y" or "n" (or just press <return> for "n") diff3 pro/hello.pro.renamed-merge.working pro/hello.pro.renamed-merge.merge-left.r1 pro/hello.pro.renamed-merge.merge-right.r9 |
---|
| 65 | ==== |
---|
| 66 | 1:3c |
---|
| 67 | Local contents (1) |
---|
| 68 | 2:2a |
---|
| 69 | 3:3c |
---|
| 70 | Merge contents (1) |
---|
| 71 | D pro/hello.pro.renamed-local |
---|
| 72 | Resolved conflicted state of 'pro/hello.pro' |
---|
| 73 | __OUT__ |
---|
| 74 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 75 | #------------------------------------------------------------------------------- |
---|
| 76 | # Tests fcm conflicts: rename, rename, diff rename, discard local (status) |
---|
| 77 | TEST_KEY=$TEST_KEY_BASE-discard-status |
---|
| 78 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
| 79 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
| 80 | M . |
---|
| 81 | D pro/hello.pro.renamed-local |
---|
| 82 | A + pro/hello.pro.renamed-merge |
---|
| 83 | __OUT__ |
---|
| 84 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 85 | #------------------------------------------------------------------------------- |
---|
| 86 | # Tests fcm conflicts: rename, rename, diff rename, discard local (cat) |
---|
| 87 | TEST_KEY=$TEST_KEY_BASE-discard-cat |
---|
| 88 | run_pass "$TEST_KEY" cat pro/hello.pro.renamed-merge |
---|
| 89 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
| 90 | PRO HELLO |
---|
| 91 | END |
---|
| 92 | Merge contents (1) |
---|
| 93 | __OUT__ |
---|
| 94 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 95 | #------------------------------------------------------------------------------- |
---|
| 96 | cd $TEST_DIR |
---|
| 97 | rm -rf $TEST_DIR/wc |
---|
| 98 | mkdir $TEST_DIR/wc |
---|
| 99 | svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc |
---|
| 100 | cd $TEST_DIR/wc |
---|
| 101 | #------------------------------------------------------------------------------- |
---|
| 102 | # Tests fcm conflicts: rename, rename, diff rename, keep local |
---|
| 103 | TEST_KEY=$TEST_KEY_BASE-keep |
---|
| 104 | fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ren >/dev/null |
---|
| 105 | run_pass "$TEST_KEY" fcm conflicts <<__IN__ |
---|
| 106 | y |
---|
| 107 | __IN__ |
---|
| 108 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
| 109 | [info] pro/hello.pro: in tree conflict. |
---|
| 110 | Locally: renamed to pro/hello.pro.renamed-local. |
---|
| 111 | Externally: renamed to pro/hello.pro.renamed-merge. |
---|
| 112 | Answer (y) to accept the local rename. |
---|
| 113 | Answer (n) to accept the external rename. |
---|
| 114 | You can then merge in changes. |
---|
| 115 | Keep the local version? |
---|
| 116 | Enter "y" or "n" (or just press <return> for "n") diff3 pro/hello.pro.renamed-local.working pro/hello.pro.renamed-local.merge-left.r1 pro/hello.pro.renamed-local.merge-right.r9 |
---|
| 117 | ==== |
---|
| 118 | 1:3c |
---|
| 119 | Local contents (1) |
---|
| 120 | 2:2a |
---|
| 121 | 3:3c |
---|
| 122 | Merge contents (1) |
---|
| 123 | Reverted 'pro/hello.pro.renamed-merge' |
---|
| 124 | Resolved conflicted state of 'pro/hello.pro' |
---|
| 125 | __OUT__ |
---|
| 126 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 127 | #------------------------------------------------------------------------------- |
---|
| 128 | # Tests fcm conflicts: rename, rename, diff rename, keep local (status) |
---|
| 129 | TEST_KEY=$TEST_KEY_BASE-keep-status |
---|
| 130 | run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/ |
---|
| 131 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
| 132 | M . |
---|
| 133 | __OUT__ |
---|
| 134 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 135 | #------------------------------------------------------------------------------- |
---|
| 136 | # Tests fcm conflicts: rename, rename, diff rename, keep local (cat) |
---|
| 137 | TEST_KEY=$TEST_KEY_BASE-keep-cat |
---|
| 138 | run_pass "$TEST_KEY" cat pro/hello.pro.renamed-local |
---|
| 139 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
| 140 | PRO HELLO |
---|
| 141 | END |
---|
| 142 | Local contents (1) |
---|
| 143 | __OUT__ |
---|
| 144 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 145 | teardown |
---|