-
Notifications
You must be signed in to change notification settings - Fork 999
/
t67-hub
194 lines (171 loc) · 6.26 KB
/
t67-hub
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# vim: syn=sh:
for bc in 0 1
do
cd $TESTDIR
$TESTDIR/rollback || die "rollback failed"
editrc GL_BIG_CONFIG $bc
editrc GL_WILDREPOS 1
rm -rf $ADC_PATH
mkdir $ADC_PATH || die "mkdir $ADC_PATH failed"
cp ../contrib/adc/* $ADC_PATH
echo "\$GL_ADC_PATH = '$ADC_PATH';" | addrc
runremote rm -f .gitolite.down
# ----------
name "INTERNAL"
echo "
@alice = u1
@bob = u2
@parent = r1
@child = r2
repo @parent
RW+ = @alice
RW = tester
R = @bob
@children = child/CREATOR/..*
repo @children
C = @all
RW+ = CREATOR
" | ugc
expect_push_ok "master -> master"
name "setup: parent gets some branches"
cd ~/td
runlocal git clone u1:r1
cd r1
mdc base1; mdc base2; mdc base3
runlocal git branch p3
runlocal git branch p2
runlocal git branch p1
mdc p1a; mdc p1b; mdc p1c
runlocal git checkout p2
mdc p2a; mdc p2b; mdc p2c
runlocal git checkout p3
mdc p3a; mdc p3b; mdc p3c
runlocal git push origin --all
expect "To u1:r1"
expect "\* \[new branch\] master -> master"
expect "\* \[new branch\] p1 -> p1"
expect "\* \[new branch\] p2 -> p2"
expect "\* \[new branch\] p3 -> p3"
name "setup: child is cloned and adds b1 and b2"
cd ~/td
runlocal ssh u2 fork r1 child/u2/myr1
runremote ls -al $TEST_BASE/child/u2/myr1.git/gl-forked-from
expect "$USER $USER 3 .* $TEST_BASE/child/u2/myr1.git/gl-forked-from"
runremote cat $TEST_BASE/child/u2/myr1.git/gl-forked-from
expect r1
runlocal git clone u2:child/u2/myr1
cd myr1
runlocal git checkout -b b1 origin/p1
mdc c1
runlocal git checkout -b b2 origin/p2
mdc d1; mdc d2
runlocal git checkout -b b3 origin/p3
mdc e1; mdc e2; mdc e3
runlocal git push origin b1 b2 b3
expect "To u2:child/u2/myr1"
expect "\* \[new branch\] b1 -> b1"
expect "\* \[new branch\] b2 -> b2"
expect "\* \[new branch\] b3 -> b3"
name "bob sends in a few pull requests"
printf "hello\nthere" | runlocal ssh u2 hub request-pull child/u2/myr1 b1
notexpect .
printf "hi\nthere" | runlocal ssh u2 hub request-pull child/u2/myr1 b2
notexpect .
printf "hello\nagain" | runlocal ssh u2 hub request-pull child/u2/myr1 b3
notexpect .
name "bob checks his pending requests"
runlocal ssh u2 hub request-status child/u2/myr1
expect "1 child/u2/myr1 (u2) b1 pending"
expect "2 child/u2/myr1 (u2) b2 pending"
expect "3 child/u2/myr1 (u2) b3 pending"
name "alice checks her pull requests"
runlocal ssh u1 hub list-requests r1
expect "1 child/u2/myr1 (u2) b1 pending"
expect "2 child/u2/myr1 (u2) b2 pending"
expect "3 child/u2/myr1 (u2) b3 pending"
name "alice views request 1"
runlocal ssh u1 hub view-request r1 1
expect "1 child/u2/myr1 (u2) b1 pending"
expect ^hello
expect ^there
name "alice views log and diffs"
runlocal ssh u1 hub view-log r1 1
expect "commit [0-9a-f]*$"
expect "Author: gitolite tester .tester@example.com."
expect "setup: child is cloned and adds b1 and b2"
runlocal ssh u1 hub view-log r1 3 --oneline
expect "setup: child is cloned and adds b1 and b2"
notexpect commit
diffargs=`tac ~/1 | cut -f1 -d' ' | sed -n -e1p -e3p`
wc < ~/1 > ~/2; > ~/1
expect "3 30 150"
runlocal ssh u1 hub view-log r1 2 b1
expect "fatal: ambiguous argument 'b1': unknown revision or path not in the working tree."
runlocal ssh u1 hub view-diff r1 3 $diffargs
expect "diff.*e2"
expect "diff.*e3"
expect "new file mode"
name "alice tries to view a SHA she shouldnt"
echo > ~/1
echo > ~/2
runlocal ssh u1 hub view-diff r1 2 $diffargs
notexpect "diff.*e2"
notexpect "diff.*e3"
notexpect "new file mode"
expect "invalid SHA:"
name "alice rejects 2, fetches 3"
echo captain was sober today | runlocal ssh u1 hub reject r1 2
notexpect .
echo | runlocal ssh u1 hub fetch r1 3
expect "user u2 asked you to"
expect "git fetch git://gl.example.com/child/u2/myr1 b3"
expect "From $TEST_BASE_FULL/child/u2/myr1"
expect "\* \[new branch\] b3 -> requests/child/b3"
name "bob checks his pending requests"
runlocal ssh u2 hub request-status child/u2/myr1
expect "1 child/u2/myr1 (u2) b1 pending"
expect "2 child/u2/myr1 (u2) b2 rejected by u1"
expect "3 child/u2/myr1 (u2) b3 fetched by u1"
name "alice checks her pull requests"
runlocal ssh u1 hub list-requests r1
expect "1 child/u2/myr1 (u2) b1 pending"
expect "2 child/u2/myr1 (u2) b2 rejected by u1"
expect "3 child/u2/myr1 (u2) b3 fetched by u1"
name "alice checks her pull requests by pattern"
runlocal ssh u1 hub list-requests r1 rej
notexpect "1 child/u2/myr1 (u2) b1 pending"
expect "2 child/u2/myr1 (u2) b2 rejected by u1"
notexpect "3 child/u2/myr1 (u2) b3 fetched by u1"
runlocal ssh u1 hub list-requests r1 pend rej
expect "1 child/u2/myr1 (u2) b1 pending"
expect "2 child/u2/myr1 (u2) b2 rejected by u1"
notexpect "3 child/u2/myr1 (u2) b3 fetched by u1"
name "alice accepts 3, then checks her pull requests"
echo the rain in spain | runlocal ssh u1 hub accept r1 3
notexpect .
runlocal ssh u1 hub list-requests r1
expect "1 child/u2/myr1 (u2) b1 pending"
expect "2 child/u2/myr1 (u2) b2 rejected by u1"
expect "3 child/u2/myr1 (u2) b3 accepted by u1"
name "bob checks the request-status on each request"
runlocal ssh u2 hub request-status child/u2/myr1 1
expect "1 child/u2/myr1 (u2) b1 pending"
expect "^Message:"
expect "^hello"
expect "^there"
runlocal ssh u2 hub request-status child/u2/myr1 2
expect "1 child/u2/myr1 (u2) b2 rejected by u1"
expect "^Message:"
expect "^hi"
expect "^there"
expect "Rejected. Message to requestor:"
expect "captain was sober today"
runlocal ssh u2 hub request-status child/u2/myr1 3
expect "1 child/u2/myr1 (u2) b3 accepted by u1"
expect "^Message:"
expect "^hello"
expect "^again"
expect "Accepted. Message to requestor:"
expect "the rain in spain"
name "INTERNAL"
done