New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
03-tree-delete-rename.t in vendors/t/fcm-conflicts – NEMO

source: vendors/t/fcm-conflicts/03-tree-delete-rename.t @ 10669

Last change on this file since 10669 was 10669, checked in by nicolasmartin, 5 years ago

Import latest FCM release from Github into the repository for testing

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