source: LMDZ6/branches/Amaury_dev/tools/fcm/t/fcm-conflicts/07-tree-rename-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: 7.3 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
25tests 18
26#-------------------------------------------------------------------------------
27setup
28init_repos
29init_branch ctrl $REPOS_URL
30init_branch_wc ren_ed $REPOS_URL
31# Set a special (null) fcm-graphic-merge diff editor.
32export FCM_GRAPHIC_MERGE=fcm-dummy-diff
33cd $TEST_DIR/wc
34#-------------------------------------------------------------------------------
35# Tests fcm conflicts: rename, edit, discard local
36TEST_KEY=$TEST_KEY_BASE-discard
37svn switch -q $ROOT_URL/branches/dev/Share/ctrl
38svn rename -q pro/hello.pro pro/hello.pro.renamed
39svn commit -q -m "Renamed conflict file (local)"
40svn update -q
41echo "Local contents (1)" >>pro/hello.pro.renamed
42svn commit -q -m "Modified conflict file (local)"
43svn update -q
44svn switch -q $ROOT_URL/branches/dev/Share/ren_ed
45echo "Merge contents (1)" >>pro/hello.pro
46svn commit -q -m "Modified conflict file  (merge)"
47svn update -q
48svn switch -q $ROOT_URL/branches/dev/Share/ctrl
49fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ed >/dev/null
50if [[ $SVN_MINOR_VERSION == "1.14" ]]; then
51  run_pass "$TEST_KEY" fcm conflicts <<__IN__
52y
53__IN__
54else
55  run_pass "$TEST_KEY" fcm conflicts <<__IN__
56n
57__IN__
58fi
59file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
60#IF SVN1.8/9/10 [info] pro/hello.pro: in tree conflict.
61#IF SVN1.14 [info] pro/hello.pro.renamed: in text conflict.
62#IF SVN1.8/9/10 Locally: renamed to pro/hello.pro.renamed.
63#IF SVN1.8/9/10 Externally: edited.
64#IF SVN1.8/9/10 Answer (y) to accept the local rename.
65#IF SVN1.8/9/10 Answer (n) to keep the file.
66#IF SVN1.8/9/10 You can then merge in changes.
67#IF SVN1.8/9/10 Keep the local version?
68#IF SVN1.8/9/10 Enter "y" or "n" (or just press <return> for "n") diff3 pro/hello.pro.renamed.working pro/hello.pro.renamed.merge-left.r1 pro/hello.pro.renamed.merge-right.r8
69#IF SVN1.14 diff3 $PWD/pro/hello.pro.renamed.3.tmp $PWD/pro/hello.pro.renamed.tmp $PWD/pro/hello.pro.renamed.2.tmp
70====
711:3c
72  Local contents (1)
732:2a
743:3c
75  Merge contents (1)
76#IF SVN1.8/9/10 A         pro/hello.pro
77#IF SVN1.8/9/10 D         pro/hello.pro.renamed
78#IF SVN1.8/9 Resolved conflicted state of 'pro/hello.pro'
79#IF SVN1.10 Tree conflict at 'pro/hello.pro' marked as resolved.
80#IF SVN1.14 Run "svn resolve --accept working pro/hello.pro.renamed"?
81#IF SVN1.14 Enter "y" or "n" (or just press <return> for "n") Merge conflicts in 'pro/hello.pro.renamed' marked as resolved.
82__OUT__
83file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
84#-------------------------------------------------------------------------------
85# Tests fcm conflicts: rename, edit, discard local (status)
86TEST_KEY=$TEST_KEY_BASE-discard-status
87run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
88file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
89 M      .
90#IF SVN1.8/9/10 A  +    pro/hello.pro
91#IF SVN1.8/9/10         > moved from pro/hello.pro.renamed
92#IF SVN1.8/9/10 D       pro/hello.pro.renamed
93#IF SVN1.8/9/10         > moved to pro/hello.pro
94#IF SVN1.14 M       pro/hello.pro.renamed
95__OUT__
96file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
97#-------------------------------------------------------------------------------
98# Tests fcm conflicts: rename, edit, discard local (cat)
99TEST_KEY=$TEST_KEY_BASE-discard-cat
100if [[ $SVN_MINOR_VERSION == "1.14" ]]; then
101  run_pass "$TEST_KEY" cat pro/hello.pro.renamed
102else
103  run_pass "$TEST_KEY" cat pro/hello.pro
104fi
105file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
106PRO HELLO
107END
108#IF SVN1.14 <<<<<<< .working
109Local contents (1)
110#IF SVN1.14 ||||||| .old
111#IF SVN1.14 =======
112#IF SVN1.14 Merge contents (1)
113#IF SVN1.14 >>>>>>> .new
114__OUT__
115file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
116#-------------------------------------------------------------------------------
117cd $TEST_DIR
118rm -rf $TEST_DIR/wc
119mkdir $TEST_DIR/wc
120svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc
121cd $TEST_DIR/wc
122#-------------------------------------------------------------------------------
123# Tests fcm conflicts: rename, edit, keep local
124TEST_KEY=$TEST_KEY_BASE-keep
125fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ed >/dev/null
126run_pass "$TEST_KEY" fcm conflicts <<__IN__
127y
128__IN__
129file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
130#IF SVN1.8/9/10 [info] pro/hello.pro: in tree conflict.
131#IF SVN1.14 [info] pro/hello.pro.renamed: in text conflict.
132#IF SVN1.8/9/10 Locally: renamed to pro/hello.pro.renamed.
133#IF SVN1.8/9/10 Externally: edited.
134#IF SVN1.8/9/10 Answer (y) to accept the local rename.
135#IF SVN1.8/9/10 Answer (n) to keep the file.
136#IF SVN1.8/9/10 You can then merge in changes.
137#IF SVN1.8/9/10 Keep the local version?
138#IF SVN1.8/9/10 Enter "y" or "n" (or just press <return> for "n") diff3 pro/hello.pro.renamed.working pro/hello.pro.renamed.merge-left.r1 pro/hello.pro.renamed.merge-right.r8
139#IF SVN1.14 diff3 $PWD/pro/hello.pro.renamed.3.tmp $PWD/pro/hello.pro.renamed.tmp $PWD/pro/hello.pro.renamed.2.tmp
140====
1411:3c
142  Local contents (1)
1432:2a
1443:3c
145  Merge contents (1)
146#IF SVN1.8/9 Resolved conflicted state of 'pro/hello.pro'
147#IF SVN1.10 Tree conflict at 'pro/hello.pro' marked as resolved.
148#IF SVN1.14 Run "svn resolve --accept working pro/hello.pro.renamed"?
149#IF SVN1.14 Enter "y" or "n" (or just press <return> for "n") Merge conflicts in 'pro/hello.pro.renamed' marked as resolved.
150__OUT__
151file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
152#-------------------------------------------------------------------------------
153# Tests fcm conflicts: rename, edit, keep local (status)
154TEST_KEY=$TEST_KEY_BASE-keep-status
155run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
156file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
157 M      .
158#IF SVN1.14 M       pro/hello.pro.renamed
159__OUT__
160file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
161#-------------------------------------------------------------------------------
162# Tests fcm conflicts: rename, edit, keep local (cat)
163TEST_KEY=$TEST_KEY_BASE-keep-cat
164run_pass "$TEST_KEY" cat pro/hello.pro.renamed
165file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
166PRO HELLO
167END
168#IF SVN1.14 <<<<<<< .working
169Local contents (1)
170#IF SVN1.14 ||||||| .old
171#IF SVN1.14 =======
172#IF SVN1.14 Merge contents (1)
173#IF SVN1.14 >>>>>>> .new
174__OUT__
175file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
176teardown
Note: See TracBrowser for help on using the repository browser.