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

source: vendors/t/fcm-conflicts/08-tree-rename-rename-diff.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: 5.8 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 18
26#-------------------------------------------------------------------------------
27setup
28init_repos
29init_branch ctrl $REPOS_URL
30init_branch_wc ren_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: rename, rename, diff rename, 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-local
39svn commit -q -m "Renamed conflict file (local)"
40svn update -q
41echo "Local contents (1)" >>pro/hello.pro.renamed-local
42svn commit -q -m "Modified conflict file (local)"
43svn update -q
44svn switch -q $ROOT_URL/branches/dev/Share/ren_ren
45echo "Merge contents (1)" >>pro/hello.pro
46svn commit -q -m "Modified conflict file  (merge)"
47svn update -q
48svn rename -q pro/hello.pro pro/hello.pro.renamed-merge
49svn commit -q -m "Renamed conflict file (merge)"
50svn update -q
51svn switch -q $ROOT_URL/branches/dev/Share/ctrl
52fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ren >/dev/null
53run_pass "$TEST_KEY" fcm conflicts <<__IN__
54n
55__IN__
56file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
57[info] pro/hello.pro: in tree conflict.
58Locally: renamed to pro/hello.pro.renamed-local.
59Externally: renamed to pro/hello.pro.renamed-merge.
60Answer (y) to accept the local rename.
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-merge.working pro/hello.pro.renamed-merge.merge-left.r1 pro/hello.pro.renamed-merge.merge-right.r9
65====
661:3c
67  Local contents (1)
682:2a
693:3c
70  Merge contents (1)
71D         pro/hello.pro.renamed-local
72Resolved conflicted state of 'pro/hello.pro'
73__OUT__
74file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
75#-------------------------------------------------------------------------------
76# Tests fcm conflicts: rename, rename, diff 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.renamed-local
82A  +    pro/hello.pro.renamed-merge
83__OUT__
84file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
85#-------------------------------------------------------------------------------
86# Tests fcm conflicts: rename, rename, diff rename, discard local (cat)
87TEST_KEY=$TEST_KEY_BASE-discard-cat
88run_pass "$TEST_KEY" cat pro/hello.pro.renamed-merge
89file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
90PRO HELLO
91END
92Merge contents (1)
93__OUT__
94file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
95#-------------------------------------------------------------------------------
96cd $TEST_DIR
97rm -rf $TEST_DIR/wc
98mkdir $TEST_DIR/wc
99svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc
100cd $TEST_DIR/wc
101#-------------------------------------------------------------------------------
102# Tests fcm conflicts: rename, rename, diff rename, keep local
103TEST_KEY=$TEST_KEY_BASE-keep
104fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ren >/dev/null
105run_pass "$TEST_KEY" fcm conflicts <<__IN__
106y
107__IN__
108file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
109[info] pro/hello.pro: in tree conflict.
110Locally: renamed to pro/hello.pro.renamed-local.
111Externally: renamed to pro/hello.pro.renamed-merge.
112Answer (y) to accept the local rename.
113Answer (n) to accept the external rename.
114You can then merge in changes.
115Keep the local version?
116Enter "y" or "n" (or just press <return> for "n") diff3 pro/hello.pro.renamed-local.working pro/hello.pro.renamed-local.merge-left.r1 pro/hello.pro.renamed-local.merge-right.r9
117====
1181:3c
119  Local contents (1)
1202:2a
1213:3c
122  Merge contents (1)
123Reverted 'pro/hello.pro.renamed-merge'
124Resolved conflicted state of 'pro/hello.pro'
125__OUT__
126file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
127#-------------------------------------------------------------------------------
128# Tests fcm conflicts: rename, rename, diff rename, 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
135#-------------------------------------------------------------------------------
136# Tests fcm conflicts: rename, rename, diff rename, keep local (cat)
137TEST_KEY=$TEST_KEY_BASE-keep-cat
138run_pass "$TEST_KEY" cat pro/hello.pro.renamed-local
139file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
140PRO HELLO
141END
142Local contents (1)
143__OUT__
144file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
145teardown
Note: See TracBrowser for help on using the repository browser.