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

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

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

File size: 5.5 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 18
27#-------------------------------------------------------------------------------
28setup
29init_repos
30init_branch ctrl $REPOS_URL
31init_branch_wc del_ed $REPOS_URL
32export SVN_EDITOR="sed -i 1i\foo"
33# Set a special (null) fcm-graphic-merge diff editor.
34export FCM_GRAPHIC_MERGE=fcm-dummy-diff
35cd $TEST_DIR/wc
36#-------------------------------------------------------------------------------
37# Tests fcm conflicts: delete, edit, discard local
38TEST_KEY=$TEST_KEY_BASE-discard
39svn switch -q $ROOT_URL/branches/dev/Share/ctrl
40svn delete -q pro/hello.pro
41svn commit -q -m "Deleted local copy of conflict file"
42svn update -q
43svn switch -q $ROOT_URL/branches/dev/Share/del_ed
44echo "Merge contents (1)" >>pro/hello.pro
45svn commit -q -m "Modified merge copy of conflict file"
46svn update -q
47svn switch -q $ROOT_URL/branches/dev/Share/ctrl
48fcm merge --non-interactive $ROOT_URL/branches/dev/Share/del_ed >/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: edited.
56Answer (y) to accept the local delete.
57Answer (n) to keep the file.
58Keep the local version?
59Enter "y" or "n" (or just press <return> for "n") A         pro/hello.pro
60#IF SVN1.8/9 Resolved conflicted state of 'pro/hello.pro'
61#IF SVN1.10/14 Tree conflict at 'pro/hello.pro' marked as resolved.
62__OUT__
63file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
64#-------------------------------------------------------------------------------
65# Tests fcm conflicts: delete, edit, discard local (status)
66TEST_KEY=$TEST_KEY_BASE-discard-status
67run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
68file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
69 M      .
70A  +    pro/hello.pro
71__OUT__
72file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
73#-------------------------------------------------------------------------------
74# Tests fcm conflicts: delete, edit, discard local (info)
75TEST_KEY=$TEST_KEY_BASE-discard-info
76run_pass "$TEST_KEY" svn info pro/hello.pro
77sed -i "/Date:\|Updated:\|UUID:\|Checksum\|Relative URL:\|Working Copy Root Path:/d" $TEST_DIR/"$TEST_KEY.out"
78file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
79Path: pro/hello.pro
80Name: hello.pro
81URL: $ROOT_URL/branches/dev/Share/ctrl/pro/hello.pro
82Repository Root: $REPOS_URL
83Revision: 7
84Node Kind: file
85Schedule: add
86Copied From URL: $ROOT_URL/branches/dev/Share/del_ed/pro/hello.pro
87Copied From Rev: 7
88Last Changed Author: $LOGNAME
89Last Changed Rev: 7
90
91__OUT__
92file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
93#-------------------------------------------------------------------------------
94# Tests fcm conflicts: delete, edit, discard local (cat)
95TEST_KEY=$TEST_KEY_BASE-discard-cat
96run_pass "$TEST_KEY" cat pro/hello.pro
97file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
98PRO HELLO
99END
100Merge contents (1)
101__OUT__
102file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
103#-------------------------------------------------------------------------------
104cd $TEST_DIR
105rm -rf $TEST_DIR/wc
106mkdir $TEST_DIR/wc
107svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc
108cd $TEST_DIR/wc
109#-------------------------------------------------------------------------------
110# Tests fcm conflicts: delete, edit, keep local
111TEST_KEY=$TEST_KEY_BASE-keep
112fcm merge --non-interactive $ROOT_URL/branches/dev/Share/del_ed >/dev/null
113run_pass "$TEST_KEY" fcm conflicts <<__IN__
114y
115__IN__
116file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
117[info] pro/hello.pro: in tree conflict.
118Locally: deleted.
119Externally: edited.
120Answer (y) to accept the local delete.
121Answer (n) to keep the file.
122Keep the local version?
123#IF SVN1.8/9 Enter "y" or "n" (or just press <return> for "n") Resolved conflicted state of 'pro/hello.pro'
124#IF SVN1.10/14 Enter "y" or "n" (or just press <return> for "n") Tree conflict at 'pro/hello.pro' marked as resolved.
125__OUT__
126file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
127#-------------------------------------------------------------------------------
128# Tests fcm conflicts: delete, edit, keep local (status)
129TEST_KEY=$TEST_KEY_BASE-keep-status
130run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
131file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
132 M      .
133__OUT__
134file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
135teardown
136#-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.