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.
05-tree-edit-rename.t in vendors/t/fcm-conflicts – NEMO

source: vendors/t/fcm-conflicts/05-tree-edit-rename.t @ 10669

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

Import latest FCM release from Github into the repository for testing

File size: 7.0 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#-------------------------------------------------------------------------------
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
31export SVN_EDITOR="sed -i 1i\foo"
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: edit, rename, discard local
37TEST_KEY=$TEST_KEY_BASE-discard
38svn switch -q $ROOT_URL/branches/dev/Share/ctrl
39echo "Local contents (1)" >>pro/hello.pro
40svn commit -q -m "Modified local copy of conflict file"
41svn update -q
42svn switch -q $ROOT_URL/branches/dev/Share/ed_ren
43echo "Merge contents (1)" >>pro/hello.pro
44svn rename -q pro/hello.pro pro/hello.pro.renamed
45svn commit -q -m "Modified and renamed merge copy of conflict file"
46svn update -q
47echo "Merge contents (2)" >>pro/hello.pro.renamed
48svn commit -q -m "Modified the merge copy of renamed conflict file"
49svn update -q
50svn switch -q $ROOT_URL/branches/dev/Share/ctrl
51fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ed_ren >/dev/null
52run_pass "$TEST_KEY" fcm conflicts <<__IN__
53n
54__IN__
55sed -i "/^Resolved conflicted state of 'pro\/hello.pro'$/d" $TEST_DIR/"$TEST_KEY.out"
56file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
57[info] pro/hello.pro: in tree conflict.
58Locally: edited.
59Externally: renamed to pro/hello.pro.renamed.
60Answer (y) to keep the file.
61Answer (n) to accept the external rename.
62You can then merge in changes.
63Keep the local version?
64Enter "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
65====
661:3c
67  Local contents (1)
682:2a
693:3,4c
70  Merge contents (1)
71  Merge contents (2)
72D         pro/hello.pro
73__OUT__
74file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
75#-------------------------------------------------------------------------------
76# Tests fcm conflicts: edit, rename, discard local (status)
77TEST_KEY=$TEST_KEY_BASE-discard-status
78run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
79file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
80 M      .
81D       pro/hello.pro
82A  +    pro/hello.pro.renamed
83__OUT__
84file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
85#-------------------------------------------------------------------------------
86# Tests fcm conflicts: edit, rename, discard local (info)
87TEST_KEY=$TEST_KEY_BASE-discard-info
88run_pass "$TEST_KEY" svn info pro/hello.pro.renamed
89sed -i "/Date:\|Updated:\|UUID:\|Checksum\|Relative URL:\|Working Copy Root Path:/d" $TEST_DIR/"$TEST_KEY.out"
90file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
91Path: pro/hello.pro.renamed
92Name: hello.pro.renamed
93URL: $ROOT_URL/branches/dev/Share/ctrl/pro/hello.pro.renamed
94Repository Root: $REPOS_URL
95Revision: 8
96Node Kind: file
97Schedule: add
98Copied From URL: $ROOT_URL/branches/dev/Share/ed_ren/pro/hello.pro.renamed
99Copied From Rev: 8
100Last Changed Author: $LOGNAME
101Last Changed Rev: 8
102
103__OUT__
104file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
105#-------------------------------------------------------------------------------
106# Tests fcm conflicts: delete, rename, discard local (cat)
107TEST_KEY=$TEST_KEY_BASE-discard-cat
108run_pass "$TEST_KEY" cat pro/hello.pro.renamed
109file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
110PRO HELLO
111END
112Merge contents (1)
113Merge contents (2)
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: edit, rename, keep local
124TEST_KEY=$TEST_KEY_BASE-keep
125fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ed_ren >/dev/null
126run_pass "$TEST_KEY" fcm conflicts <<__IN__
127y
128__IN__
129file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
130[info] pro/hello.pro: in tree conflict.
131Locally: edited.
132Externally: renamed to pro/hello.pro.renamed.
133Answer (y) to keep the file.
134Answer (n) to accept the external rename.
135You can then merge in changes.
136Keep the local version?
137Enter "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
138====
1391:3c
140  Local contents (1)
1412:2a
1423:3,4c
143  Merge contents (1)
144  Merge contents (2)
145Reverted 'pro/hello.pro.renamed'
146Resolved conflicted state of 'pro/hello.pro'
147__OUT__
148file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
149#-------------------------------------------------------------------------------
150# Tests fcm conflicts: edit, rename, keep local (status)
151TEST_KEY=$TEST_KEY_BASE-keep-status
152run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
153file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
154 M      .
155__OUT__
156file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
157#-------------------------------------------------------------------------------
158# Tests fcm conflicts: edit, rename, keep local (info)
159TEST_KEY=$TEST_KEY_BASE-keep-info
160run_pass "$TEST_KEY" svn info pro/hello.pro
161sed -i "/Date:\|Updated:\|UUID:\|Checksum\|Relative URL:\|Working Copy Root Path:/d" $TEST_DIR/"$TEST_KEY.out"
162file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
163Path: pro/hello.pro
164Name: hello.pro
165URL: $ROOT_URL/branches/dev/Share/ctrl/pro/hello.pro
166Repository Root: $REPOS_URL
167Revision: 8
168Node Kind: file
169Schedule: normal
170Last Changed Author: $LOGNAME
171Last Changed Rev: 6
172
173__OUT__
174file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
175#-------------------------------------------------------------------------------
176# Tests fcm conflicts: delete, rename, keep local (cat)
177TEST_KEY=$TEST_KEY_BASE-keep-cat
178run_pass "$TEST_KEY" cat pro/hello.pro
179file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
180PRO HELLO
181END
182Local contents (1)
183__OUT__
184file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
185teardown
186#-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.