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

source: vendors/t/fcm-conflicts/07-tree-rename-edit.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.4 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_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
50run_pass "$TEST_KEY" fcm conflicts <<__IN__
51n
52__IN__
53file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
54[info] pro/hello.pro: in tree conflict.
55Locally: renamed to pro/hello.pro.renamed.
56Externally: edited.
57Answer (y) to accept the local rename.
58Answer (n) to keep the file.
59You can then merge in changes.
60Keep the local version?
61Enter "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
62====
631:3c
64  Local contents (1)
652:2a
663:3c
67  Merge contents (1)
68A         pro/hello.pro
69D         pro/hello.pro.renamed
70Resolved conflicted state of 'pro/hello.pro'
71__OUT__
72file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
73#-------------------------------------------------------------------------------
74# Tests fcm conflicts: rename, edit, discard local (status)
75TEST_KEY=$TEST_KEY_BASE-discard-status
76run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
77sed -i "/^ \{8\}> moved /d" $TEST_DIR/"$TEST_KEY.out"
78file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
79 M      .
80A  +    pro/hello.pro
81D       pro/hello.pro.renamed
82__OUT__
83file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
84#-------------------------------------------------------------------------------
85# Tests fcm conflicts: rename, edit, discard local (cat)
86TEST_KEY=$TEST_KEY_BASE-discard-cat
87run_pass "$TEST_KEY" cat pro/hello.pro
88file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
89PRO HELLO
90END
91Local contents (1)
92__OUT__
93file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
94#-------------------------------------------------------------------------------
95cd $TEST_DIR
96rm -rf $TEST_DIR/wc
97mkdir $TEST_DIR/wc
98svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc
99cd $TEST_DIR/wc
100#-------------------------------------------------------------------------------
101# Tests fcm conflicts: rename, edit, keep local
102TEST_KEY=$TEST_KEY_BASE-keep
103fcm merge --non-interactive $ROOT_URL/branches/dev/Share/ren_ed >/dev/null
104run_pass "$TEST_KEY" fcm conflicts <<__IN__
105y
106__IN__
107file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
108[info] pro/hello.pro: in tree conflict.
109Locally: renamed to pro/hello.pro.renamed.
110Externally: edited.
111Answer (y) to accept the local rename.
112Answer (n) to keep the file.
113You can then merge in changes.
114Keep the local version?
115Enter "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
116====
1171:3c
118  Local contents (1)
1192:2a
1203:3c
121  Merge contents (1)
122Resolved conflicted state of 'pro/hello.pro'
123__OUT__
124file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
125#-------------------------------------------------------------------------------
126# Tests fcm conflicts: rename, edit, keep local (status)
127TEST_KEY=$TEST_KEY_BASE-keep-status
128run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
129file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
130 M      .
131__OUT__
132file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
133#-------------------------------------------------------------------------------
134# Tests fcm conflicts: rename, edit, keep local (cat)
135TEST_KEY=$TEST_KEY_BASE-keep-cat
136run_pass "$TEST_KEY" cat pro/hello.pro.renamed
137file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
138PRO HELLO
139END
140Local contents (1)
141__OUT__
142file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
143teardown
Note: See TracBrowser for help on using the repository browser.