source: LMDZ6/branches/Amaury_dev/tools/fcm/t/fcm-conflicts/05-tree-edit-rename.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: 9.1 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 24
26#-------------------------------------------------------------------------------
27setup
28init_repos
29init_branch ctrl $REPOS_URL
30init_branch_wc ed_ren $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: edit, rename, discard local
36TEST_KEY=$TEST_KEY_BASE-discard
37svn switch -q $ROOT_URL/branches/dev/Share/ctrl
38echo "Local contents (1)" >>pro/hello.pro
39svn commit -q -m "Modified local copy of conflict file"
40svn update -q
41svn switch -q $ROOT_URL/branches/dev/Share/ed_ren
42echo "Merge contents (1)" >>pro/hello.pro
43svn rename -q pro/hello.pro pro/hello.pro.renamed
44svn commit -q -m "Modified and renamed merge copy of conflict file"
45svn update -q
46echo "Merge contents (2)" >>pro/hello.pro.renamed
47svn commit -q -m "Modified the merge copy of renamed conflict file"
48svn update -q
49svn switch -q $ROOT_URL/branches/dev/Share/ctrl
50fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ed_ren >/dev/null
51if [[ $SVN_MINOR_VERSION == "1.14" ]]; then
52  run_pass "$TEST_KEY" fcm conflicts <<__IN__
53y
54__IN__
55else
56  run_pass "$TEST_KEY" fcm conflicts <<__IN__
57n
58__IN__
59fi
60file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
61#IF SVN1.8/9/10 [info] pro/hello.pro: in tree conflict.
62#IF SVN1.14 [info] pro/hello.pro.renamed: in text conflict.
63#IF SVN1.8/9/10 Locally: edited.
64#IF SVN1.8/9/10 Externally: renamed to pro/hello.pro.renamed.
65#IF SVN1.8/9/10 Answer (y) to keep the file.
66#IF SVN1.8/9/10 Answer (n) to accept the external rename.
67#IF SVN1.8/9/10 You can then merge in changes.
68#IF SVN1.8/9/10 Keep the local version?
69#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
70#IF SVN1.14 diff3 $PWD/pro/hello.pro.renamed.3.tmp $PWD/pro/hello.pro.renamed.tmp $PWD/pro/hello.pro.renamed.2.tmp
71====
721:3c
73  Local contents (1)
742:2a
753:3,4c
76  Merge contents (1)
77  Merge contents (2)
78#IF SVN1.8/9/10 D         pro/hello.pro
79#IF SVN1.14 Run "svn resolve --accept working pro/hello.pro.renamed"?
80#IF SVN1.14 Enter "y" or "n" (or just press <return> for "n") Merge conflicts in 'pro/hello.pro.renamed' marked as resolved.
81__OUT__
82file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
83#-------------------------------------------------------------------------------
84# Tests fcm conflicts: edit, rename, discard local (status)
85TEST_KEY=$TEST_KEY_BASE-discard-status
86run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
87file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
88 M      .
89D       pro/hello.pro
90#IF SVN1.14         > moved to pro/hello.pro.renamed
91A  +    pro/hello.pro.renamed
92#IF SVN1.14         > moved from pro/hello.pro
93__OUT__
94file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
95#-------------------------------------------------------------------------------
96# Tests fcm conflicts: edit, rename, discard local (info)
97TEST_KEY=$TEST_KEY_BASE-discard-info
98run_pass "$TEST_KEY" svn info pro/hello.pro.renamed
99sed -i "/Date:\|Updated:\|UUID:\|Checksum\|Relative URL:\|Working Copy Root Path:/d" $TEST_DIR/"$TEST_KEY.out"
100file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
101Path: pro/hello.pro.renamed
102Name: hello.pro.renamed
103URL: $ROOT_URL/branches/dev/Share/ctrl/pro/hello.pro.renamed
104Repository Root: $REPOS_URL
105Revision: 8
106Node Kind: file
107Schedule: add
108#IF SVN1.8/9/10 Copied From URL: $ROOT_URL/branches/dev/Share/ed_ren/pro/hello.pro.renamed
109#IF SVN1.14 Copied From URL: $ROOT_URL/branches/dev/Share/ctrl/pro/hello.pro
110Copied From Rev: 8
111#IF SVN1.14 Moved From: pro/hello.pro
112Last Changed Author: $LOGNAME
113#IF SVN1.8/9/10 Last Changed Rev: 8
114#IF SVN1.14 Last Changed Rev: 6
115
116__OUT__
117file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
118#-------------------------------------------------------------------------------
119# Tests fcm conflicts: delete, rename, discard local (cat)
120TEST_KEY=$TEST_KEY_BASE-discard-cat
121run_pass "$TEST_KEY" cat pro/hello.pro.renamed
122file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
123PRO HELLO
124END
125#IF SVN1.14 <<<<<<< .working
126#IF SVN1.14 Local contents (1)
127#IF SVN1.14 ||||||| .old
128#IF SVN1.14 =======
129Merge contents (1)
130Merge contents (2)
131#IF SVN1.14 >>>>>>> .new
132__OUT__
133file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
134#-------------------------------------------------------------------------------
135cd $TEST_DIR
136rm -rf $TEST_DIR/wc
137mkdir $TEST_DIR/wc
138svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc
139cd $TEST_DIR/wc
140#-------------------------------------------------------------------------------
141# Tests fcm conflicts: edit, rename, keep local
142TEST_KEY=$TEST_KEY_BASE-keep
143fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ed_ren >/dev/null
144run_pass "$TEST_KEY" fcm conflicts <<__IN__
145y
146__IN__
147file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
148#IF SVN1.8/9/10 [info] pro/hello.pro: in tree conflict.
149#IF SVN1.14 [info] pro/hello.pro.renamed: in text conflict.
150#IF SVN1.8/9/10 Locally: edited.
151#IF SVN1.8/9/10 Externally: renamed to pro/hello.pro.renamed.
152#IF SVN1.8/9/10 Answer (y) to keep the file.
153#IF SVN1.8/9/10 Answer (n) to accept the external rename.
154#IF SVN1.8/9/10 You can then merge in changes.
155#IF SVN1.8/9/10 Keep the local version?
156#IF SVN1.8/9/10 Enter "y" or "n" (or just press <return> for "n") diff3 pro/hello.pro.working pro/hello.pro.merge-left.r1 pro/hello.pro.merge-right.r8
157#IF SVN1.14 diff3 $PWD/pro/hello.pro.renamed.3.tmp $PWD/pro/hello.pro.renamed.tmp $PWD/pro/hello.pro.renamed.2.tmp
158====
1591:3c
160  Local contents (1)
1612:2a
1623:3,4c
163  Merge contents (1)
164  Merge contents (2)
165#IF SVN1.8/9/10 Reverted 'pro/hello.pro.renamed'
166#IF SVN1.8/9 Resolved conflicted state of 'pro/hello.pro'
167#IF SVN1.10 Tree conflict at 'pro/hello.pro' marked as resolved.
168#IF SVN1.14 Run "svn resolve --accept working pro/hello.pro.renamed"?
169#IF SVN1.14 Enter "y" or "n" (or just press <return> for "n") Merge conflicts in 'pro/hello.pro.renamed' marked as resolved.
170__OUT__
171file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
172#-------------------------------------------------------------------------------
173# Tests fcm conflicts: edit, rename, keep local (status)
174TEST_KEY=$TEST_KEY_BASE-keep-status
175run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
176file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
177 M      .
178#IF SVN1.14 D       pro/hello.pro
179#IF SVN1.14         > moved to pro/hello.pro.renamed
180#IF SVN1.14 A  +    pro/hello.pro.renamed
181#IF SVN1.14         > moved from pro/hello.pro
182__OUT__
183file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
184#-------------------------------------------------------------------------------
185# Tests fcm conflicts: edit, rename, keep local (info)
186TEST_KEY=$TEST_KEY_BASE-keep-info
187run_pass "$TEST_KEY" svn info pro/hello.pro
188sed -i "/Date:\|Updated:\|UUID:\|Checksum\|Relative URL:\|Working Copy Root Path:/d" $TEST_DIR/"$TEST_KEY.out"
189file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
190Path: pro/hello.pro
191Name: hello.pro
192URL: $ROOT_URL/branches/dev/Share/ctrl/pro/hello.pro
193Repository Root: $REPOS_URL
194Revision: 8
195Node Kind: file
196#IF SVN1.8/9/10 Schedule: normal
197#IF SVN1.14 Schedule: delete
198#IF SVN1.14 Moved To: pro/hello.pro.renamed
199Last Changed Author: $LOGNAME
200Last Changed Rev: 6
201
202__OUT__
203file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
204#-------------------------------------------------------------------------------
205# Tests fcm conflicts: delete, rename, keep local (cat)
206TEST_KEY=$TEST_KEY_BASE-keep-cat
207if [[ $SVN_MINOR_VERSION == "1.14" ]]; then
208  run_pass "$TEST_KEY" cat pro/hello.pro.renamed
209else
210  run_pass "$TEST_KEY" cat pro/hello.pro
211fi
212file_cmp_filtered "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
213PRO HELLO
214END
215#IF SVN1.14 <<<<<<< .working
216Local contents (1)
217#IF SVN1.14 ||||||| .old
218#IF SVN1.14 =======
219#IF SVN1.14 Merge contents (1)
220#IF SVN1.14 Merge contents (2)
221#IF SVN1.14 >>>>>>> .new
222__OUT__
223file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
224teardown
225#-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.