~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to test.sh

  • Committer: Martin Pool
  • Date: 2005-05-03 07:48:35 UTC
  • Revision ID: mbp@sourcefrog.net-20050503074835-0133bd0c16440fcd
doc

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
# This must already exist and be in the right place
10
10
if ! [ -d bzr-test.tmp ] 
11
11
then
12
 
    echo "please create bzr-test.tmp"
 
12
    echo "please create directory bzr-test.tmp"
13
13
    exit 1
14
14
fi
15
15
 
 
16
echo "testing `which bzr`"
 
17
bzr --version | head -n 1
 
18
echo
 
19
 
16
20
rm -rf bzr-test.tmp
17
21
mkdir bzr-test.tmp
18
22
 
 
23
# save it for real errors
 
24
exec 3>&2
 
25
 
19
26
exec > bzr-test.log
20
27
exec 2>&1 
21
28
set -x
22
29
 
 
30
quitter() {
 
31
    echo "tests failed, look in bzr-test.log" >&3; exit 2; 
 
32
}
 
33
 
 
34
trap quitter ERR
 
35
 
23
36
cd bzr-test.tmp 
24
37
rm -rf .bzr
25
38
 
 
39
mkdir branch1
 
40
cd branch1
 
41
 
26
42
# some information commands
27
43
bzr help
28
44
bzr version
29
45
 
 
46
[ $(bzr help commands | wc -l) -gt 20 ]
 
47
 
 
48
# user identification is set
 
49
bzr whoami
 
50
bzr whoami --email
 
51
 
30
52
# invalid commands are detected
31
53
! bzr pants
32
54
 
 
55
# TODO: test unicode user names
 
56
 
 
57
bzr help
 
58
 
33
59
# some experiments with renames
34
60
bzr init
35
61
echo "hello world" > test.txt
38
64
# should be the only unknown file
39
65
[ "`bzr unknowns`" = test.txt ]
40
66
 
 
67
bzr status --all > status.tmp
 
68
! diff -u - status.tmp <<EOF
 
69
?       status.tmp
 
70
?       test.txt
 
71
EOF
 
72
 
 
73
# command alias
 
74
bzr st --all | diff -u - status.tmp
 
75
 
41
76
# can't rename unversioned files; use the regular unix rename command
42
77
! bzr rename test.txt new-test.txt
43
78
 
49
84
bzr rename test.txt newname.txt
50
85
[ "`bzr status`" = "A       newname.txt" ]
51
86
 
 
87
[ `bzr revno` = 0 ]
52
88
bzr commit -m "add first revision"
 
89
[ `bzr revno` = 1 ]
53
90
 
54
91
# now more complicated renames
55
92
mkdir sub1
77
114
cd ../../
78
115
 
79
116
bzr commit -m "more renames"
80
 
 
81
 
 
82
 
 
83
 
 
84
 
 
 
117
[ `bzr revno` = 2 ] 
 
118
 
 
119
# now try pulling that file back out, checking it was stored properly
 
120
[ "`bzr cat -r 1 newname.txt`" = "hello world" ]
 
121
 
 
122
! bzr rename sub1 sub1/knotted-up
 
123
 
 
124
 
 
125
 
 
126
 
 
127
 
 
128
# now test hardlinked branches in subdirectories
 
129
cd ..
 
130
[ -d branch2 ] && rm -rf branch2
 
131
cp -al branch1 branch2
 
132
 
 
133
cd branch2
 
134
bzr log 
 
135
[ `bzr revno` = 2 ]
 
136
 
 
137
echo "added in branch2" > new-in-2.txt
 
138
bzr add new-in-2.txt
 
139
bzr commit -m "add file to branch 2 only"
 
140
 
 
141
[ `bzr revno` = 3 ]
 
142
 
 
143
cd ../branch1
 
144
[ `bzr revno` = 2 ]
 
145
 
 
146
bzr check
 
147
 
 
148
 
 
149
echo "tests completed ok" >&3