[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 | # Test "fcm branch-create" and "fcm branch-list", alternate username. |
---|
| 21 | #------------------------------------------------------------------------------- |
---|
| 22 | . $(dirname $0)/test_header |
---|
| 23 | #------------------------------------------------------------------------------- |
---|
| 24 | setup |
---|
| 25 | init_repos |
---|
| 26 | cd $TEST_DIR |
---|
| 27 | svn cp -m 't1' --parents -q \ |
---|
| 28 | $ROOT_URL/trunk@1 $ROOT_URL/branches/dev/barn.owl/r1_wing |
---|
| 29 | if ! svnserve -r $TEST_DIR -d --pid-file pid-file; then |
---|
| 30 | if [[ -s pid-file ]]; then |
---|
| 31 | kill $(cat pid-file) |
---|
| 32 | fi |
---|
| 33 | skip_all 'svnserve failed' |
---|
| 34 | teardown |
---|
| 35 | exit |
---|
| 36 | fi |
---|
| 37 | tests 9 |
---|
| 38 | #------------------------------------------------------------------------------- |
---|
| 39 | # Tests fcm branch-create, alternate username |
---|
| 40 | TEST_KEY="$TEST_KEY_BASE" |
---|
| 41 | FCM_SUBVERSION_SERVERS_CONF="$PWD/$TEST_KEY-svn-servers-conf" |
---|
| 42 | cat >$FCM_SUBVERSION_SERVERS_CONF <<'__CONF__' |
---|
| 43 | [groups] |
---|
| 44 | bar=localhost |
---|
| 45 | |
---|
| 46 | [bar] |
---|
| 47 | username=barn.owl |
---|
| 48 | __CONF__ |
---|
| 49 | SVN_EDITOR=true \ |
---|
| 50 | FCM_SUBVERSION_SERVERS_CONF=$FCM_SUBVERSION_SERVERS_CONF run_pass "$TEST_KEY" \ |
---|
| 51 | fcm branch-create hello svn://localhost/test_repos <<<'n' |
---|
| 52 | echo >>"$TEST_KEY.out" # Insert newline |
---|
| 53 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
| 54 | [info] Source: svn://localhost/test_repos/trunk@1 (4) |
---|
| 55 | [info] true: starting commit message editor... |
---|
| 56 | Change summary: |
---|
| 57 | -------------------------------------------------------------------------------- |
---|
| 58 | A svn://localhost/test_repos/branches/dev/barn.owl/r1_hello |
---|
| 59 | -------------------------------------------------------------------------------- |
---|
| 60 | Commit message is as follows: |
---|
| 61 | -------------------------------------------------------------------------------- |
---|
| 62 | Created /branches/dev/barn.owl/r1_hello from /trunk@1. |
---|
| 63 | -------------------------------------------------------------------------------- |
---|
| 64 | Create the branch? |
---|
| 65 | Enter "y" or "n" (or just press <return> for "n") |
---|
| 66 | __OUT__ |
---|
| 67 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 68 | #------------------------------------------------------------------------------- |
---|
| 69 | TEST_KEY=$TEST_KEY_BASE-1 |
---|
| 70 | FCM_SUBVERSION_SERVERS_CONF="$PWD/$TEST_KEY-svn-servers-conf" |
---|
| 71 | cat >$FCM_SUBVERSION_SERVERS_CONF <<'__CONF__' |
---|
| 72 | [groups] |
---|
| 73 | bar=localhost |
---|
| 74 | |
---|
| 75 | [bar] |
---|
| 76 | username=barn.owl |
---|
| 77 | __CONF__ |
---|
| 78 | FCM_SUBVERSION_SERVERS_CONF=$FCM_SUBVERSION_SERVERS_CONF run_pass "$TEST_KEY" \ |
---|
| 79 | fcm branch-list svn://localhost/test_repos |
---|
| 80 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<'__OUT__' |
---|
| 81 | [info] svn://localhost/test_repos@4: 1 match(es) |
---|
| 82 | svn://localhost/test_repos/branches/dev/barn.owl/r1_wing@4 |
---|
| 83 | __OUT__ |
---|
| 84 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 85 | #------------------------------------------------------------------------------- |
---|
| 86 | TEST_KEY=$TEST_KEY_BASE-0 |
---|
| 87 | cat >$FCM_SUBVERSION_SERVERS_CONF <<'__CONF__' |
---|
| 88 | [groups] |
---|
| 89 | bar=localhost |
---|
| 90 | |
---|
| 91 | [bar] |
---|
| 92 | username=honey.bee |
---|
| 93 | __CONF__ |
---|
| 94 | FCM_SUBVERSION_SERVERS_CONF=$FCM_SUBVERSION_SERVERS_CONF run_pass "$TEST_KEY" \ |
---|
| 95 | fcm branch-list svn://localhost/test_repos |
---|
| 96 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<'__OUT__' |
---|
| 97 | [info] svn://localhost/test_repos@4: 0 match(es) |
---|
| 98 | __OUT__ |
---|
| 99 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
| 100 | #------------------------------------------------------------------------------- |
---|
| 101 | kill $(cat pid-file) |
---|
| 102 | teardown |
---|
| 103 | exit |
---|