summaryrefslogtreecommitdiff
path: root/subversion/tests/libsvn_wc/create_wc_for_upgrade.sh
blob: 622595c5135e85e2e161cbfa9cd9d5752ea3a6b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/sh
#
#  create_wc_for_upgrade.sh : create a working copy for upgrade testing
#
#  Subversion is a tool for revision control.
#  See http://subversion.apache.org/ for more information.
#
# ====================================================================
#    Licensed to the Apache Software Foundation (ASF) under one
#    or more contributor license agreements.  See the NOTICE file
#    distributed with this work for additional information
#    regarding copyright ownership.  The ASF licenses this file
#    to you under the Apache License, Version 2.0 (the
#    "License"); you may not use this file except in compliance
#    with the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing,
#    software distributed under the License is distributed on an
#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#    KIND, either express or implied.  See the License for the
#    specific language governing permissions and limitations
#    under the License.
######################################################################

#
# USAGE:
#   $ ./create_wc_for_upgrade.sh /path/to/svn-1.x /tmp/wc-1.x
#
# At this point, the working copy will be constructed for *property*
# testing. Future changes may set up other testing scenarios.
#
# Note that 'svnadmin' must be in PATH
#

if test $# != 2; then
  echo "ERROR: not enough parameters"
  exit 1
fi

SVN="$1"
WC="$2"

if test -e "${WC}"; then
  echo "ERROR: ${WC} exists."
  exit 1
fi

# some higgery-jiggery to get to the parent directory in order to create
# the repo as a sibling.
mkdir "${WC}"
cd "${WC}"
cd ..
rmdir "${WC}"

# create a repo that is usable by any SVN. bail out if anything goes wrong.
svnadmin create --pre-1.4-compatible repo
"${SVN}" co file://`pwd`/repo "${WC}"
cd "${WC}" || exit 1

# we need some files with properties for copy sources and for deletions
echo alpha > alpha
echo beta > beta
echo gamma > gamma
echo delta > delta
echo epsilon > epsilon
"${SVN}" add alpha beta gamma delta epsilon
"${SVN}" propset a-prop a-value1 alpha
"${SVN}" propset b-prop b-value1 beta
"${SVN}" propset g-prop g-value1 gamma
"${SVN}" propset d-prop d-value1 delta
"${SVN}" propset e-prop e-value1 epsilon
"${SVN}" commit -m "commit files"

### the code below needs to be rejiggered for svn <= 1.3. revert base is not
### available, so some of the operations are not allowed.

# a file with .base and .revert
"${SVN}" delete alpha
"${SVN}" copy epsilon alpha
### whoops. there is an alpha.working (when using 1.7-dev, tho no ACTUAL_NODE
### row is created).

# a file with just .working
# zeta = epsilon+1
echo zeta > zeta
"${SVN}" add zeta
"${SVN}" propset z-prop z-value zeta

# a file with .base and .working
"${SVN}" propset b-more b-value2 beta

# a file with .base, .revert, and .working
"${SVN}" delete gamma
"${SVN}" copy epsilon gamma
"${SVN}" propset g-more g-value2 gamma

# a file with .revert and .working
"${SVN}" delete delta
echo delta revisited > delta
"${SVN}" add delta
"${SVN}" propset d-more d-value2 delta

# a file with just .revert
"${SVN}" delete epsilon
echo epsilon revisited > epsilon
"${SVN}" add epsilon