source: vendors/FCM-2017.10.0/t/fcm-merge/02-reverse.t @ 11150

Last change on this file since 11150 was 10672, checked in by nicolasmartin, 3 years ago

Reimport latest FCM release

File size: 4.7 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 merge --reverse".
21#-------------------------------------------------------------------------------
22. "$(dirname "$0")/test_header"
23#-------------------------------------------------------------------------------
24check_svn_version
25tests 13
26#-------------------------------------------------------------------------------
27svnadmin create 'foo'
28URL_FOO="file://${PWD}/foo"
29svn mkdir -q -m"season greetings" --no-auth-cache "${URL_FOO}/greet"
30echo 'Merry Xmas' >'xmas.txt'
31echo 'Happy New Year' >'new-year.txt'
32for NAME in 'xmas.txt' 'new-year.txt'; do
33    svn import -q -m"import ${NAME}" --no-auth-cache \
34        "${NAME}" "${URL_FOO}/greet/${NAME}"
35done
36svn mkdir -q -m"hello world" --no-auth-cache --parents "${URL_FOO}/hello/trunk"
37svn co -q "${URL_FOO}/hello/trunk" 'hello-wc'
38cat >'hello-wc/world.txt' <<'__TXT__'
39Hello Mercury!
40Hello Venus!
41Hollow Earth!
42Hello Mars!
43__TXT__
44svn add -q 'hello-wc/world.txt'
45svn ci -q -m'hollow worlds' --no-auth-cache 'hello-wc'
46cat >'hello-wc/world.txt' <<'__TXT__'
47Hello Mercury!
48Hello Venus!
49Hello Earth!
50Hello Mars!
51__TXT__
52svn ci -q -m'hello worlds' --no-auth-cache 'hello-wc'
53rm -fr 'hello-wc'
54#-------------------------------------------------------------------------------
55TEST_KEY="${TEST_KEY_BASE}-r3"
56svn co -q "${URL_FOO}/greet" 'greet-wc'
57cd 'greet-wc'
58run_pass "${TEST_KEY}" fcm merge --reverse --non-interactive
59cd ..
60svn status 'greet-wc' >"${TEST_KEY}.status"
61file_cmp "${TEST_KEY}.status" "${TEST_KEY}.status" <<'__STATUS__'
62D       greet-wc/new-year.txt
63__STATUS__
64file_cmp "${TEST_KEY}.message" 'greet-wc/#commit_message#' <<'__MESSAGE__'
65--FCM message (will be inserted automatically)--
66Reversed r3 of /greet
67
68__MESSAGE__
69rm -rf 'greet-wc'
70#-------------------------------------------------------------------------------
71TEST_KEY="${TEST_KEY_BASE}-r2"
72svn co -q "${URL_FOO}/greet" 'greet-wc'
73cd 'greet-wc'
74run_pass "${TEST_KEY}" fcm merge --reverse -r 2 --non-interactive
75cd ..
76
77svn status 'greet-wc' >"${TEST_KEY}.status"
78file_cmp "${TEST_KEY}.status" "${TEST_KEY}.status" <<'__STATUS__'
79D       greet-wc/xmas.txt
80__STATUS__
81file_cmp "${TEST_KEY}.message" 'greet-wc/#commit_message#' <<'__MESSAGE__'
82--FCM message (will be inserted automatically)--
83Reversed r2 of /greet
84
85__MESSAGE__
86rm -rf 'greet-wc'
87#-------------------------------------------------------------------------------
88TEST_KEY="${TEST_KEY_BASE}-r2-r3"
89svn co -q "${URL_FOO}/greet" 'greet-wc'
90cd 'greet-wc'
91run_pass "${TEST_KEY}" fcm merge --reverse -r 3:1 --non-interactive
92cd ..
93
94svn status 'greet-wc' | sort >"${TEST_KEY}.status"
95file_cmp "${TEST_KEY}.status" "${TEST_KEY}.status" <<'__STATUS__'
96D       greet-wc/new-year.txt
97D       greet-wc/xmas.txt
98__STATUS__
99file_cmp "${TEST_KEY}.message" 'greet-wc/#commit_message#' <<'__MESSAGE__'
100--FCM message (will be inserted automatically)--
101Reversed r3:1 of /greet
102
103__MESSAGE__
104rm -rf 'greet-wc'
105#-------------------------------------------------------------------------------
106TEST_KEY="${TEST_KEY_BASE}-r6"
107svn co -q "${URL_FOO}/hello/trunk" 'hello-wc'
108cd 'hello-wc'
109run_pass "${TEST_KEY}" fcm merge --reverse --non-interactive
110cd ..
111svn status 'hello-wc' >"${TEST_KEY}.status"
112file_cmp "${TEST_KEY}.status" "${TEST_KEY}.status" <<'__STATUS__'
113M       hello-wc/world.txt
114__STATUS__
115svn diff 'hello-wc' >"${TEST_KEY}.diff"
116file_cmp "${TEST_KEY}.diff" "${TEST_KEY}.diff" <<'__DIFF__'
117Index: hello-wc/world.txt
118===================================================================
119--- hello-wc/world.txt  (revision 6)
120+++ hello-wc/world.txt  (working copy)
121@@ -1,4 +1,4 @@
122 Hello Mercury!
123 Hello Venus!
124-Hello Earth!
125+Hollow Earth!
126 Hello Mars!
127__DIFF__
128file_cmp "${TEST_KEY}.message" 'hello-wc/#commit_message#' <<'__MESSAGE__'
129--FCM message (will be inserted automatically)--
130Reversed r6 of /hello/trunk
131
132__MESSAGE__
133rm -rf 'hello-wc'
134#-------------------------------------------------------------------------------
135exit
Note: See TracBrowser for help on using the repository browser.