source: LMDZ6/branches/Amaury_dev/tools/fcm/t/fcm-conflicts/03-tree-delete-rename.t @ 5095

Last change on this file since 5095 was 5095, checked in by abarral, 2 months ago

Revert cosp*/ from the trunk, as it's external code
Add missing bits from FCM2 source

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