##// END OF EJS Templates
tests: port value-less unbundle capability test to test-push-http.t...
Gregory Szorc -
r36318:fefd57bd stable
parent child Browse files
Show More
@@ -1,202 +1,234 b''
1 #require killdaemons
1 #require killdaemons
2
2
3 $ hg init test
3 $ hg init test
4 $ cd test
4 $ cd test
5 $ echo a > a
5 $ echo a > a
6 $ hg ci -Ama
6 $ hg ci -Ama
7 adding a
7 adding a
8 $ cd ..
8 $ cd ..
9 $ hg clone test test2
9 $ hg clone test test2
10 updating to branch default
10 updating to branch default
11 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
11 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 $ cd test2
12 $ cd test2
13 $ echo a >> a
13 $ echo a >> a
14 $ hg ci -mb
14 $ hg ci -mb
15 $ req() {
15 $ req() {
16 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
16 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
17 > cat hg.pid >> $DAEMON_PIDS
17 > cat hg.pid >> $DAEMON_PIDS
18 > hg --cwd ../test2 push http://localhost:$HGPORT/
18 > hg --cwd ../test2 push http://localhost:$HGPORT/
19 > exitstatus=$?
19 > exitstatus=$?
20 > killdaemons.py
20 > killdaemons.py
21 > echo % serve errors
21 > echo % serve errors
22 > cat errors.log
22 > cat errors.log
23 > return $exitstatus
23 > return $exitstatus
24 > }
24 > }
25 $ cd ../test
25 $ cd ../test
26
26
27 expect ssl error
27 expect ssl error
28
28
29 $ req
29 $ req
30 pushing to http://localhost:$HGPORT/
30 pushing to http://localhost:$HGPORT/
31 searching for changes
31 searching for changes
32 abort: HTTP Error 403: ssl required
32 abort: HTTP Error 403: ssl required
33 % serve errors
33 % serve errors
34 [255]
34 [255]
35
35
36 expect authorization error
36 expect authorization error
37
37
38 $ echo '[web]' > .hg/hgrc
38 $ echo '[web]' > .hg/hgrc
39 $ echo 'push_ssl = false' >> .hg/hgrc
39 $ echo 'push_ssl = false' >> .hg/hgrc
40 $ req
40 $ req
41 pushing to http://localhost:$HGPORT/
41 pushing to http://localhost:$HGPORT/
42 searching for changes
42 searching for changes
43 abort: authorization failed
43 abort: authorization failed
44 % serve errors
44 % serve errors
45 [255]
45 [255]
46
46
47 expect authorization error: must have authorized user
47 expect authorization error: must have authorized user
48
48
49 $ echo 'allow_push = unperson' >> .hg/hgrc
49 $ echo 'allow_push = unperson' >> .hg/hgrc
50 $ req
50 $ req
51 pushing to http://localhost:$HGPORT/
51 pushing to http://localhost:$HGPORT/
52 searching for changes
52 searching for changes
53 abort: authorization failed
53 abort: authorization failed
54 % serve errors
54 % serve errors
55 [255]
55 [255]
56
56
57 expect success
57 expect success
58
58
59 $ cat > $TESTTMP/hook.sh <<'EOF'
59 $ cat > $TESTTMP/hook.sh <<'EOF'
60 > echo "phase-move: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE"
60 > echo "phase-move: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE"
61 > EOF
61 > EOF
62
62
63 $ cat >> .hg/hgrc <<EOF
63 $ cat >> .hg/hgrc <<EOF
64 > allow_push = *
64 > allow_push = *
65 > [hooks]
65 > [hooks]
66 > changegroup = sh -c "printenv.py changegroup 0"
66 > changegroup = sh -c "printenv.py changegroup 0"
67 > pushkey = sh -c "printenv.py pushkey 0"
67 > pushkey = sh -c "printenv.py pushkey 0"
68 > txnclose-phase.test = sh $TESTTMP/hook.sh
68 > txnclose-phase.test = sh $TESTTMP/hook.sh
69 > EOF
69 > EOF
70 $ req
70 $ req
71 pushing to http://localhost:$HGPORT/
71 pushing to http://localhost:$HGPORT/
72 searching for changes
72 searching for changes
73 remote: adding changesets
73 remote: adding changesets
74 remote: adding manifests
74 remote: adding manifests
75 remote: adding file changes
75 remote: adding file changes
76 remote: added 1 changesets with 1 changes to 1 files
76 remote: added 1 changesets with 1 changes to 1 files
77 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
77 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
78 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
78 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
79 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
79 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
80 % serve errors
80 % serve errors
81 $ hg rollback
81 $ hg rollback
82 repository tip rolled back to revision 0 (undo serve)
82 repository tip rolled back to revision 0 (undo serve)
83
83
84 expect success, server lacks the httpheader capability
84 expect success, server lacks the httpheader capability
85
85
86 $ CAP=httpheader
86 $ CAP=httpheader
87 $ . "$TESTDIR/notcapable"
87 $ . "$TESTDIR/notcapable"
88 $ req
88 $ req
89 pushing to http://localhost:$HGPORT/
89 pushing to http://localhost:$HGPORT/
90 searching for changes
90 searching for changes
91 remote: adding changesets
91 remote: adding changesets
92 remote: adding manifests
92 remote: adding manifests
93 remote: adding file changes
93 remote: adding file changes
94 remote: added 1 changesets with 1 changes to 1 files
94 remote: added 1 changesets with 1 changes to 1 files
95 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
95 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
96 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
96 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
97 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
97 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
98 % serve errors
98 % serve errors
99 $ hg rollback
99 $ hg rollback
100 repository tip rolled back to revision 0 (undo serve)
100 repository tip rolled back to revision 0 (undo serve)
101
101
102 expect success, server lacks the unbundlehash capability
102 expect success, server lacks the unbundlehash capability
103
103
104 $ CAP=unbundlehash
104 $ CAP=unbundlehash
105 $ . "$TESTDIR/notcapable"
105 $ . "$TESTDIR/notcapable"
106 $ req
106 $ req
107 pushing to http://localhost:$HGPORT/
107 pushing to http://localhost:$HGPORT/
108 searching for changes
108 searching for changes
109 remote: adding changesets
109 remote: adding changesets
110 remote: adding manifests
110 remote: adding manifests
111 remote: adding file changes
111 remote: adding file changes
112 remote: added 1 changesets with 1 changes to 1 files
112 remote: added 1 changesets with 1 changes to 1 files
113 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
113 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
114 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
114 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
115 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
115 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
116 % serve errors
116 % serve errors
117 $ hg rollback
117 $ hg rollback
118 repository tip rolled back to revision 0 (undo serve)
118 repository tip rolled back to revision 0 (undo serve)
119
119
120 expect success, pre-d1b16a746db6 server supports the unbundle capability, but
121 has no parameter
122
123 $ cat <<EOF > notcapable-unbundleparam.py
124 > from mercurial import extensions, httppeer
125 > def capable(orig, self, name):
126 > if name == 'unbundle':
127 > return True
128 > return orig(self, name)
129 > def uisetup(ui):
130 > extensions.wrapfunction(httppeer.httppeer, 'capable', capable)
131 > EOF
132 $ cp $HGRCPATH $HGRCPATH.orig
133 $ cat <<EOF >> $HGRCPATH
134 > [extensions]
135 > notcapable-unbundleparam = `pwd`/notcapable-unbundleparam.py
136 > EOF
137 $ req
138 pushing to http://localhost:$HGPORT/
139 searching for changes
140 remote: adding changesets
141 remote: adding manifests
142 remote: adding file changes
143 remote: added 1 changesets with 1 changes to 1 files
144 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
145 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
146 remote: changegroup hook: * (glob)
147 % serve errors
148 $ hg rollback
149 repository tip rolled back to revision 0 (undo serve)
150 $ mv $HGRCPATH.orig $HGRCPATH
151
120 expect push success, phase change failure
152 expect push success, phase change failure
121
153
122 $ cat > .hg/hgrc <<EOF
154 $ cat > .hg/hgrc <<EOF
123 > [web]
155 > [web]
124 > push_ssl = false
156 > push_ssl = false
125 > allow_push = *
157 > allow_push = *
126 > [hooks]
158 > [hooks]
127 > prepushkey = sh -c "printenv.py prepushkey 1"
159 > prepushkey = sh -c "printenv.py prepushkey 1"
128 > [devel]
160 > [devel]
129 > legacy.exchange=phases
161 > legacy.exchange=phases
130 > EOF
162 > EOF
131 $ req
163 $ req
132 pushing to http://localhost:$HGPORT/
164 pushing to http://localhost:$HGPORT/
133 searching for changes
165 searching for changes
134 remote: adding changesets
166 remote: adding changesets
135 remote: adding manifests
167 remote: adding manifests
136 remote: adding file changes
168 remote: adding file changes
137 remote: added 1 changesets with 1 changes to 1 files
169 remote: added 1 changesets with 1 changes to 1 files
138 remote: prepushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_OLD=1 HG_PENDING=$TESTTMP/test HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
170 remote: prepushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_OLD=1 HG_PENDING=$TESTTMP/test HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
139 remote: pushkey-abort: prepushkey hook exited with status 1
171 remote: pushkey-abort: prepushkey hook exited with status 1
140 remote: transaction abort!
172 remote: transaction abort!
141 remote: rollback completed
173 remote: rollback completed
142 abort: updating ba677d0156c1 to public failed
174 abort: updating ba677d0156c1 to public failed
143 % serve errors
175 % serve errors
144 [255]
176 [255]
145
177
146 expect phase change success
178 expect phase change success
147
179
148 $ cat >> .hg/hgrc <<EOF
180 $ cat >> .hg/hgrc <<EOF
149 > prepushkey = sh -c "printenv.py prepushkey 0"
181 > prepushkey = sh -c "printenv.py prepushkey 0"
150 > [devel]
182 > [devel]
151 > legacy.exchange=
183 > legacy.exchange=
152 > EOF
184 > EOF
153 $ req
185 $ req
154 pushing to http://localhost:$HGPORT/
186 pushing to http://localhost:$HGPORT/
155 searching for changes
187 searching for changes
156 remote: adding changesets
188 remote: adding changesets
157 remote: adding manifests
189 remote: adding manifests
158 remote: adding file changes
190 remote: adding file changes
159 remote: added 1 changesets with 1 changes to 1 files
191 remote: added 1 changesets with 1 changes to 1 files
160 % serve errors
192 % serve errors
161 $ hg rollback
193 $ hg rollback
162 repository tip rolled back to revision 0 (undo serve)
194 repository tip rolled back to revision 0 (undo serve)
163
195
164 expect authorization error: all users denied
196 expect authorization error: all users denied
165
197
166 $ echo '[web]' > .hg/hgrc
198 $ echo '[web]' > .hg/hgrc
167 $ echo 'push_ssl = false' >> .hg/hgrc
199 $ echo 'push_ssl = false' >> .hg/hgrc
168 $ echo 'deny_push = *' >> .hg/hgrc
200 $ echo 'deny_push = *' >> .hg/hgrc
169 $ req
201 $ req
170 pushing to http://localhost:$HGPORT/
202 pushing to http://localhost:$HGPORT/
171 searching for changes
203 searching for changes
172 abort: authorization failed
204 abort: authorization failed
173 % serve errors
205 % serve errors
174 [255]
206 [255]
175
207
176 expect authorization error: some users denied, users must be authenticated
208 expect authorization error: some users denied, users must be authenticated
177
209
178 $ echo 'deny_push = unperson' >> .hg/hgrc
210 $ echo 'deny_push = unperson' >> .hg/hgrc
179 $ req
211 $ req
180 pushing to http://localhost:$HGPORT/
212 pushing to http://localhost:$HGPORT/
181 searching for changes
213 searching for changes
182 abort: authorization failed
214 abort: authorization failed
183 % serve errors
215 % serve errors
184 [255]
216 [255]
185
217
186 $ cat > .hg/hgrc <<EOF
218 $ cat > .hg/hgrc <<EOF
187 > [web]
219 > [web]
188 > push_ssl = false
220 > push_ssl = false
189 > allow_push = *
221 > allow_push = *
190 > [experimental]
222 > [experimental]
191 > httppostargs=true
223 > httppostargs=true
192 > EOF
224 > EOF
193 $ req
225 $ req
194 pushing to http://localhost:$HGPORT/
226 pushing to http://localhost:$HGPORT/
195 searching for changes
227 searching for changes
196 remote: adding changesets
228 remote: adding changesets
197 remote: adding manifests
229 remote: adding manifests
198 remote: adding file changes
230 remote: adding file changes
199 remote: added 1 changesets with 1 changes to 1 files
231 remote: added 1 changesets with 1 changes to 1 files
200 % serve errors
232 % serve errors
201
233
202 $ cd ..
234 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now