1 | #!/bin/bash |
---|
2 | # ------------------------------------------------------------------------------ |
---|
3 | # Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
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 update". |
---|
21 | #------------------------------------------------------------------------------- |
---|
22 | . $(dirname $0)/test_header |
---|
23 | #------------------------------------------------------------------------------- |
---|
24 | check_svn_version |
---|
25 | tests 7 |
---|
26 | #------------------------------------------------------------------------------- |
---|
27 | setup |
---|
28 | init_repos |
---|
29 | init_merge_branches merge1 merge2 $REPOS_URL |
---|
30 | export SVN_EDITOR="sed -i 1i\foo" |
---|
31 | cd $TEST_DIR/wc |
---|
32 | #------------------------------------------------------------------------------- |
---|
33 | # Tests fcm update -r PREV |
---|
34 | svn switch -q $ROOT_URL/branches/dev/Share/merge1 |
---|
35 | TEST_KEY=$TEST_KEY_BASE-r-PREV |
---|
36 | run_pass "$TEST_KEY" fcm update -r PREV <<__IN__ |
---|
37 | y |
---|
38 | __IN__ |
---|
39 | merge_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
40 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__ |
---|
41 | update: status of ".": |
---|
42 | ? unversioned_file |
---|
43 | update: continue? |
---|
44 | Enter "y" or "n" (or just press <return> for "n"): |
---|
45 | Updating '.': |
---|
46 | D added_directory |
---|
47 | D added_file |
---|
48 | D module/tree_conflict_file |
---|
49 | U lib/python/info/poems.py |
---|
50 | U module/hello_constants.f90 |
---|
51 | U module/hello_constants.inc |
---|
52 | U module/hello_constants_dummy.inc |
---|
53 | U subroutine/hello_sub_dummy.h |
---|
54 | Updated to revision 4. |
---|
55 | __OUT__ |
---|
56 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
57 | #------------------------------------------------------------------------------- |
---|
58 | # Tests fcm update |
---|
59 | rm unversioned_file |
---|
60 | TEST_KEY=$TEST_KEY_BASE-normal |
---|
61 | run_pass "$TEST_KEY" fcm update <<__IN__ |
---|
62 | y |
---|
63 | __IN__ |
---|
64 | sed -n "/^ *\*/p" "$TEST_DIR/$TEST_KEY.out" | sort -o \ |
---|
65 | "$TEST_DIR/$TEST_KEY.update-status.sorted.out" |
---|
66 | file_cmp "$TEST_KEY.update-status.sorted.out" \ |
---|
67 | "$TEST_KEY.update-status.sorted.out" <<__OUT__ |
---|
68 | * added_directory |
---|
69 | * added_directory/hello_constants.f90 |
---|
70 | * added_directory/hello_constants.inc |
---|
71 | * added_directory/hello_constants_dummy.inc |
---|
72 | * added_file |
---|
73 | * module/tree_conflict_file |
---|
74 | * 4 . |
---|
75 | * 4 lib/python/info/poems.py |
---|
76 | * 4 module |
---|
77 | * 4 module/hello_constants.f90 |
---|
78 | * 4 module/hello_constants.inc |
---|
79 | * 4 module/hello_constants_dummy.inc |
---|
80 | * 4 subroutine/hello_sub_dummy.h |
---|
81 | __OUT__ |
---|
82 | sed -i "/^ *\*/d" "$TEST_DIR/$TEST_KEY.out" |
---|
83 | merge_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
84 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__ |
---|
85 | update: status of ".": |
---|
86 | update: continue? |
---|
87 | Enter "y" or "n" (or just press <return> for "n"): |
---|
88 | Updating '.': |
---|
89 | A added_directory |
---|
90 | A added_directory/hello_constants.f90 |
---|
91 | A added_directory/hello_constants.inc |
---|
92 | A added_directory/hello_constants_dummy.inc |
---|
93 | A added_file |
---|
94 | A module/tree_conflict_file |
---|
95 | U lib/python/info/poems.py |
---|
96 | U module/hello_constants.f90 |
---|
97 | U module/hello_constants.inc |
---|
98 | U module/hello_constants_dummy.inc |
---|
99 | U subroutine/hello_sub_dummy.h |
---|
100 | Updated to revision 9. |
---|
101 | __OUT__ |
---|
102 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
103 | teardown |
---|
104 | #------------------------------------------------------------------------------- |
---|