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.
09-tree-rename-rename-same.t in vendors/FCM-2017.10.0/t/fcm-conflicts – NEMO

source: vendors/FCM-2017.10.0/t/fcm-conflicts/09-tree-rename-rename-same.t @ 12377

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

Reimport latest FCM release

File size: 9.1 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# TODO: The behaviour exhibited by fcm conflicts in this file is wrong.
22#-------------------------------------------------------------------------------
23. $(dirname $0)/test_header
24#-------------------------------------------------------------------------------
25check_svn_version
26tests 33
27#-------------------------------------------------------------------------------
28setup
29init_repos
30init_branch ctrl $REPOS_URL
31init_branch_wc ren_ren $REPOS_URL
32# Set a special (null) fcm-graphic-merge diff editor.
33export FCM_GRAPHIC_MERGE=fcm-dummy-diff
34cd $TEST_DIR/wc
35#-------------------------------------------------------------------------------
36# Tests fcm conflicts: rename, rename, diff rename, discard local, discard local
37TEST_KEY=$TEST_KEY_BASE-discard-discard
38svn switch -q $ROOT_URL/branches/dev/Share/ctrl
39svn rename -q pro/hello.pro pro/hello.pro.renamed
40svn commit -q -m "Renamed conflict file (local)"
41svn update -q
42echo "Local contents (1)" >>pro/hello.pro.renamed
43svn commit -q -m "Modified conflict file (local)"
44svn update -q
45svn switch -q $ROOT_URL/branches/dev/Share/ren_ren
46echo "Merge contents (1)" >>pro/hello.pro
47svn commit -q -m "Modified conflict file  (merge)"
48svn update -q
49svn rename -q pro/hello.pro pro/hello.pro.renamed
50svn commit -q -m "Renamed conflict file (merge)"
51svn update -q
52svn switch -q $ROOT_URL/branches/dev/Share/ctrl
53fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ren >/dev/null
54run_pass "$TEST_KEY" fcm conflicts <<__IN__
55n
56n
57__IN__
58sed -i -n "1,8p" $TEST_DIR/"$TEST_KEY.out"
59file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
60[info] pro/hello.pro: in tree conflict.
61Locally: renamed to pro/hello.pro.renamed.
62Externally: deleted.
63Answer (y) to accept the local rename.
64Answer (n) to accept the external delete.
65Keep the local version?
66Enter "y" or "n" (or just press <return> for "n") D         pro/hello.pro.renamed
67Resolved conflicted state of 'pro/hello.pro'
68__OUT__
69file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
70#-------------------------------------------------------------------------------
71# Tests fcm conflicts: rename, rename, diff rename, discard local, discard local (status)
72TEST_KEY=$TEST_KEY_BASE-discard-discard-status
73run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
74file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
75 M      .
76D       pro/hello.pro.renamed
77__OUT__
78file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
79#-------------------------------------------------------------------------------
80cd $TEST_DIR
81rm -rf $TEST_DIR/wc
82mkdir $TEST_DIR/wc
83svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc
84cd $TEST_DIR/wc
85#-------------------------------------------------------------------------------
86# Tests fcm conflicts: rename, rename, diff rename, discard local, keep local
87TEST_KEY=$TEST_KEY_BASE-discard-keep
88fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ren >/dev/null
89run_pass "$TEST_KEY" fcm conflicts <<__IN__
90n
91y
92__IN__
93sed -i -n "1,8p" $TEST_DIR/"$TEST_KEY.out"
94file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
95[info] pro/hello.pro: in tree conflict.
96Locally: renamed to pro/hello.pro.renamed.
97Externally: deleted.
98Answer (y) to accept the local rename.
99Answer (n) to accept the external delete.
100Keep the local version?
101Enter "y" or "n" (or just press <return> for "n") D         pro/hello.pro.renamed
102Resolved conflicted state of 'pro/hello.pro'
103__OUT__
104file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
105#-------------------------------------------------------------------------------
106# Tests fcm conflicts: rename, rename, diff rename, discard local, keep local (status)
107TEST_KEY=$TEST_KEY_BASE-discard-keep-status
108run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
109file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
110 M      .
111D       pro/hello.pro.renamed
112__OUT__
113file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
114#-------------------------------------------------------------------------------
115# Tests fcm conflicts: rename, rename, diff rename, discard local, keep local (cat)
116TEST_KEY=$TEST_KEY_BASE-discard-keep-cat
117run_fail "$TEST_KEY" cat pro/hello.pro.renamed
118file_cmp "$TEST_KEY.out" "$TEST_KEY.out" </dev/null
119file_cmp "$TEST_KEY.err" "$TEST_KEY.err" <<__ERR__
120cat: pro/hello.pro.renamed: No such file or directory
121__ERR__
122#-------------------------------------------------------------------------------
123cd $TEST_DIR
124rm -rf $TEST_DIR/wc
125mkdir $TEST_DIR/wc
126svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc
127cd $TEST_DIR/wc
128#-------------------------------------------------------------------------------
129# Tests fcm conflicts: rename, rename, diff rename, keep local, discard local
130TEST_KEY=$TEST_KEY_BASE-keep-discard
131fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ren >/dev/null
132run_pass "$TEST_KEY" fcm conflicts <<__IN__
133y
134n
135__IN__
136file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
137[info] pro/hello.pro: in tree conflict.
138Locally: renamed to pro/hello.pro.renamed.
139Externally: deleted.
140Answer (y) to accept the local rename.
141Answer (n) to accept the external delete.
142Keep the local version?
143Enter "y" or "n" (or just press <return> for "n") Resolved conflicted state of 'pro/hello.pro'
144[info] pro/hello.pro.renamed: in tree conflict.
145Locally: added.
146Externally: added.
147Answer (y) to keep the local file filename.
148Answer (n) to keep the external file filename.
149Keep the local version?
150Enter "y" or "n" (or just press <return> for "n") Resolved conflicted state of 'pro/hello.pro.renamed'
151__OUT__
152file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
153#-------------------------------------------------------------------------------
154# Tests fcm conflicts: rename, rename, diff rename, keep local (status)
155TEST_KEY=$TEST_KEY_BASE-keep-discard-status
156run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
157file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
158 M      .
159M       pro/hello.pro.renamed
160__OUT__
161file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
162#-------------------------------------------------------------------------------
163# Tests fcm conflicts: rename, rename, diff rename, keep local (cat)
164TEST_KEY=$TEST_KEY_BASE-keep-discard-cat
165run_pass "$TEST_KEY" cat pro/hello.pro.renamed
166file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
167PRO HELLO
168END
169Merge contents (1)
170__OUT__
171file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
172#-------------------------------------------------------------------------------
173cd $TEST_DIR
174rm -rf $TEST_DIR/wc
175mkdir $TEST_DIR/wc
176svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc
177cd $TEST_DIR/wc
178#-------------------------------------------------------------------------------
179# Tests fcm conflicts: rename, rename, diff rename, keep local, keep local
180TEST_KEY=$TEST_KEY_BASE-keep-keep
181fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ren >/dev/null
182run_pass "$TEST_KEY" fcm conflicts <<__IN__
183y
184y
185__IN__
186file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
187[info] pro/hello.pro: in tree conflict.
188Locally: renamed to pro/hello.pro.renamed.
189Externally: deleted.
190Answer (y) to accept the local rename.
191Answer (n) to accept the external delete.
192Keep the local version?
193Enter "y" or "n" (or just press <return> for "n") Resolved conflicted state of 'pro/hello.pro'
194[info] pro/hello.pro.renamed: in tree conflict.
195Locally: added.
196Externally: added.
197Answer (y) to keep the local file filename.
198Answer (n) to keep the external file filename.
199Keep the local version?
200Enter "y" or "n" (or just press <return> for "n") Resolved conflicted state of 'pro/hello.pro.renamed'
201__OUT__
202file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
203#-------------------------------------------------------------------------------
204# Tests fcm conflicts: rename, rename, diff rename, keep local, keep local (status)
205TEST_KEY=$TEST_KEY_BASE-keep-keep-status
206run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
207file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
208 M      .
209__OUT__
210file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
211#-------------------------------------------------------------------------------
212# Tests fcm conflicts: rename, rename, diff rename, keep local, keep local (cat)
213TEST_KEY=$TEST_KEY_BASE-keep-keep-cat
214run_pass "$TEST_KEY" cat pro/hello.pro.renamed
215file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
216PRO HELLO
217END
218Local contents (1)
219__OUT__
220file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
221teardown
Note: See TracBrowser for help on using the repository browser.