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

source: vendors/t/fcm-conflicts/02-tree-delete-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.2 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 del_ed $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: delete, edit, discard local
37TEST_KEY=$TEST_KEY_BASE-discard
38svn switch -q $ROOT_URL/branches/dev/Share/ctrl
39svn delete -q pro/hello.pro
40svn commit -q -m "Deleted local copy of conflict file"
41svn update -q
42svn switch -q $ROOT_URL/branches/dev/Share/del_ed
43echo "Merge contents (1)" >>pro/hello.pro
44svn commit -q -m "Modified merge copy of conflict file"
45svn update -q
46svn switch -q $ROOT_URL/branches/dev/Share/ctrl
47fcm merge --non-interactive $ROOT_URL/branches/dev/Share/del_ed >/dev/null
48run_pass "$TEST_KEY" fcm conflicts <<__IN__
49n
50__IN__
51file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
52[info] pro/hello.pro: in tree conflict.
53Locally: deleted.
54Externally: edited.
55Answer (y) to accept the local delete.
56Answer (n) to keep the file.
57Keep the local version?
58Enter "y" or "n" (or just press <return> for "n") A         pro/hello.pro
59Resolved conflicted state of 'pro/hello.pro'
60__OUT__
61file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
62#-------------------------------------------------------------------------------
63# Tests fcm conflicts: delete, edit, discard local (status)
64TEST_KEY=$TEST_KEY_BASE-discard-status
65run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
66file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
67 M      .
68A  +    pro/hello.pro
69__OUT__
70file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
71#-------------------------------------------------------------------------------
72# Tests fcm conflicts: delete, edit, discard local (info)
73TEST_KEY=$TEST_KEY_BASE-discard-info
74run_pass "$TEST_KEY" svn info pro/hello.pro
75sed -i "/Date:\|Updated:\|UUID:\|Checksum\|Relative URL:\|Working Copy Root Path:/d" $TEST_DIR/"$TEST_KEY.out"
76file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
77Path: pro/hello.pro
78Name: hello.pro
79URL: $ROOT_URL/branches/dev/Share/ctrl/pro/hello.pro
80Repository Root: $REPOS_URL
81Revision: 7
82Node Kind: file
83Schedule: add
84Copied From URL: $ROOT_URL/branches/dev/Share/del_ed/pro/hello.pro
85Copied From Rev: 7
86Last Changed Author: $LOGNAME
87Last Changed Rev: 7
88
89__OUT__
90file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
91#-------------------------------------------------------------------------------
92# Tests fcm conflicts: delete, edit, discard local (cat)
93TEST_KEY=$TEST_KEY_BASE-discard-cat
94run_pass "$TEST_KEY" cat pro/hello.pro
95file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
96PRO HELLO
97END
98Merge contents (1)
99__OUT__
100file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
101#-------------------------------------------------------------------------------
102cd $TEST_DIR
103rm -rf $TEST_DIR/wc
104mkdir $TEST_DIR/wc
105svn checkout -q $ROOT_URL/branches/dev/Share/ctrl $TEST_DIR/wc
106cd $TEST_DIR/wc
107#-------------------------------------------------------------------------------
108# Tests fcm conflicts: delete, edit, keep local
109TEST_KEY=$TEST_KEY_BASE-keep
110fcm merge --non-interactive $ROOT_URL/branches/dev/Share/del_ed >/dev/null
111run_pass "$TEST_KEY" fcm conflicts <<__IN__
112y
113__IN__
114file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
115[info] pro/hello.pro: in tree conflict.
116Locally: deleted.
117Externally: edited.
118Answer (y) to accept the local delete.
119Answer (n) to keep the file.
120Keep the local version?
121Enter "y" or "n" (or just press <return> for "n") Resolved conflicted state of 'pro/hello.pro'
122__OUT__
123file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
124#-------------------------------------------------------------------------------
125# Tests fcm conflicts: delete, edit, keep local (status)
126TEST_KEY=$TEST_KEY_BASE-keep-status
127run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
128file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
129 M      .
130__OUT__
131file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
132teardown
133#-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.