1#!/bin/sh
2#
3#
4# Licensed to the Apache Software Foundation (ASF) under one
5# or more contributor license agreements.  See the NOTICE file
6# distributed with this work for additional information
7# regarding copyright ownership.  The ASF licenses this file
8# to you under the Apache License, Version 2.0 (the
9# "License"); you may not use this file except in compliance
10# with the License.  You may obtain a copy of the License at
11#
12#   http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing,
15# software distributed under the License is distributed on an
16# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17# KIND, either express or implied.  See the License for the
18# specific language governing permissions and limitations
19# under the License.
20#
21#
22#
23# mailer-init.sh: create and initialize a repository for the mailer tests
24#
25# USAGE: ./mailer-init.sh
26#
27
28scripts="`dirname $0`"
29scripts="`cd $scripts && pwd`"
30
31d=$scripts/mailer-init.$$
32mkdir $d
33cd $d
34echo "test directory is: $d"
35
36svnadmin create repos
37svn co file://`pwd`/repos wc
38cd wc
39
40# create a bunch of dirs and files
41mkdir dir1 dir2
42echo file1 > file1
43echo file2 > file2
44echo file3 > dir1/file3
45echo file4 > dir1/file4
46echo file5 > dir2/file5
47echo file6 > dir2/file6
48svn add *
49svn commit -m "initial load"
50
51# make some changes and set some properties
52svn ps prop1 propval1 file1
53echo change C1 >> file2
54svn ps svn:keywords Id file2
55svn ps --force svn:new_svn_prop val file2
56svn ps prop1 propval1 file2
57svn ps prop3 propval3 dir1
58echo change C2 >> dir2/file5
59svn commit -m "two file changes.  Fixes Blah#123"
60
61# copy a file and a dir and change property
62svn cp file1 dir2/file7
63svn cp dir1 dir3
64svn ps prop3 propval4 dir3
65svn commit -m "two copies"
66
67# copy and modify a file
68svn cp file1 dir3/file8
69echo change C3 >> dir3/file8
70svn commit -m "copied and changed"
71
72# change and delete properties
73svn ps svn:keywords Date file2
74svn ps prop2 propval2 file2
75svn pd prop1 file2
76svn pd svn:new_svn_prop file2
77svn ps prop3 propval4 dir1
78svn pd prop3 dir3
79svn up  # make sure our dirs are up to date
80svn commit -m "changes and deletes of properties"
81
82# add a file, add a dir, and make a change
83echo file9 > file9
84svn add file9
85svn mkdir dir4
86echo change C4 >> dir1/file3
87svn commit -m "mixed addition and change.  Fixes Blaz#456 Blah#987"
88
89# add a file, add a dir, delete a file, delete a dir, and make a change
90echo file10 > dir1/file10
91svn add dir1/file10
92svn mkdir dir3/dir5
93svn rm file2 dir2
94echo change C5 >> dir3/file3
95svn up  # make sure our dirs are up to date
96svn commit -m "adds, deletes, and a change"
97
98# copy a dir and change a file in it
99svn cp dir3 dir6
100echo change C6 >> dir6/file4
101svn commit -m "copy dir, then make a change"
102
103# add a binary file and set property to binary value
104printf "\x00\x01\x02\x03\x04\n" > file11
105svn add file11
106svn ps svn:mime-type application/octect-stream file11
107svn ps prop2 -F file11 file9
108svn commit -m "add binary file"
109
110# change the binary file and set property to non binary value
111printf "\x20\x01\x02\x20\n" > file11
112svn ps prop2 propval2 file9
113svn commit -m "change binary file"
114
115# tweak the commit dates to known quantities
116$scripts/mailer-tweak.py ../repos
117