/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to test.sh

  • Committer: Martin Pool
  • Date: 2005-04-15 08:51:11 UTC
  • Revision ID: mbp@sourcefrog.net-20050415085111-dc9ee788d2cc1216
- New 'bzr help commands'

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh -pe
 
2
 
 
3
# Simple shell-based tests for bzr.
 
4
 
 
5
# This is meant to exercise the external behaviour, command line
 
6
# parsing and similar things and compliment the inwardly-turned
 
7
# testing done by doctest.
 
8
 
 
9
# This must already exist and be in the right place
 
10
if ! [ -d bzr-test.tmp ] 
 
11
then
 
12
    echo "please create directory bzr-test.tmp"
 
13
    exit 1
 
14
fi
 
15
 
 
16
echo "testing `which bzr`"
 
17
bzr --version | head -n 1
 
18
echo
 
19
 
 
20
rm -rf bzr-test.tmp
 
21
mkdir bzr-test.tmp
 
22
 
 
23
# save it for real errors
 
24
exec 3>&2
 
25
 
 
26
exec > bzr-test.log
 
27
exec 2>&1 
 
28
set -x
 
29
 
 
30
quitter() {
 
31
    echo "tests failed, look in bzr-test.log" >&3; exit 2; 
 
32
}
 
33
 
 
34
trap quitter ERR
 
35
 
 
36
cd bzr-test.tmp 
 
37
rm -rf .bzr
 
38
 
 
39
mkdir branch1
 
40
cd branch1
 
41
 
 
42
# some information commands
 
43
bzr help
 
44
bzr version
 
45
 
 
46
[ $(bzr help commands | wc -l) -gt 20 ]
 
47
 
 
48
# invalid commands are detected
 
49
! bzr pants
 
50
 
 
51
# some experiments with renames
 
52
bzr init
 
53
echo "hello world" > test.txt
 
54
bzr unknowns
 
55
 
 
56
# should be the only unknown file
 
57
[ "`bzr unknowns`" = test.txt ]
 
58
 
 
59
bzr status --all > status.tmp
 
60
! diff -u - status.tmp <<EOF
 
61
?       status.tmp
 
62
?       test.txt
 
63
EOF
 
64
 
 
65
# command alias
 
66
bzr st --all | diff -u - status.tmp
 
67
 
 
68
# can't rename unversioned files; use the regular unix rename command
 
69
! bzr rename test.txt new-test.txt
 
70
 
 
71
# ok, so now add it and see what happens
 
72
bzr add test.txt
 
73
[ -z "`bzr unknowns`" ]
 
74
 
 
75
# after adding even before committing you can rename files
 
76
bzr rename test.txt newname.txt
 
77
[ "`bzr status`" = "A       newname.txt" ]
 
78
 
 
79
[ `bzr revno` = 0 ]
 
80
bzr commit -m "add first revision"
 
81
[ `bzr revno` = 1 ]
 
82
 
 
83
# now more complicated renames
 
84
mkdir sub1
 
85
! bzr rename newname.txt sub1
 
86
! bzr rename newname.txt sub1/foo.txt
 
87
bzr add sub1
 
88
! bzr rename newname.txt sub1
 
89
 
 
90
bzr rename newname.txt sub1/foo.txt
 
91
[ -f sub1/foo.txt ]
 
92
[ ! -f newname.txt ]
 
93
 
 
94
bzr rename sub1/foo.txt newname.txt
 
95
[ -f newname.txt ]
 
96
 
 
97
bzr rename newname.txt sub1/foo.txt
 
98
bzr rename sub1/foo.txt sub1/bar.txt
 
99
 
 
100
cd sub1
 
101
mkdir sub2
 
102
bzr add sub2
 
103
bzr rename bar.txt sub2/bar.txt
 
104
cd sub2
 
105
bzr rename bar.txt ../../bar.txt
 
106
cd ../../
 
107
 
 
108
bzr commit -m "more renames"
 
109
[ `bzr revno` = 2 ] 
 
110
 
 
111
# now try pulling that file back out, checking it was stored properly
 
112
[ "`bzr cat -r 1 newname.txt`" = "hello world" ]
 
113
 
 
114
! bzr rename sub1 sub1/knotted-up
 
115
 
 
116
 
 
117
 
 
118
 
 
119
 
 
120
# now test hardlinked branches in subdirectories
 
121
cd ..
 
122
[ -d branch2 ] && rm -rf branch2
 
123
cp -al branch1 branch2
 
124
 
 
125
cd branch2
 
126
bzr log 
 
127
[ `bzr revno` = 2 ]
 
128
 
 
129
echo "added in branch2" > new-in-2.txt
 
130
bzr add new-in-2.txt
 
131
bzr commit -m "add file to branch 2 only"
 
132
 
 
133
[ `bzr revno` = 3 ]
 
134
 
 
135
cd ../branch1
 
136
[ `bzr revno` = 2 ]
 
137
 
 
138
bzr check
 
139
 
 
140
 
 
141
echo "tests completed ok" >&3
 
 
b'\\ No newline at end of file'