##// END OF EJS Templates
tests: expand test coverage for updating phases...
Gregory Szorc -
r36320:c19e66da stable
parent child Browse files
Show More
@@ -162,7 +162,7 b' has no parameter'
162 repository tip rolled back to revision 0 (undo serve)
162 repository tip rolled back to revision 0 (undo serve)
163 $ mv $HGRCPATH.orig $HGRCPATH
163 $ mv $HGRCPATH.orig $HGRCPATH
164
164
165 expect push success, phase change failure
165 Test pushing to a publishing repository with a failing prepushkey hook
166
166
167 $ cat > .hg/hgrc <<EOF
167 $ cat > .hg/hgrc <<EOF
168 > [web]
168 > [web]
@@ -175,6 +175,10 b' expect push success, phase change failur'
175 > EOF
175 > EOF
176
176
177 #if bundle1
177 #if bundle1
178 Bundle1 works because a) phases are updated as part of changegroup application
179 and b) client checks phases after the "unbundle" command. Since it sees no
180 phase changes are necessary, it doesn't send the "pushkey" command and the
181 prepushkey hook never has to fire.
178
182
179 $ req
183 $ req
180 pushing to http://localhost:$HGPORT/
184 pushing to http://localhost:$HGPORT/
@@ -188,7 +192,8 b' expect push success, phase change failur'
188 #endif
192 #endif
189
193
190 #if bundle2
194 #if bundle2
191
195 Bundle2 sends a "pushkey" bundle2 part. This runs as part of the transaction
196 and fails the entire push.
192 $ req
197 $ req
193 pushing to http://localhost:$HGPORT/
198 pushing to http://localhost:$HGPORT/
194 searching for changes
199 searching for changes
@@ -206,30 +211,40 b' expect push success, phase change failur'
206
211
207 #endif
212 #endif
208
213
209 expect phase change success
214 Now remove the failing prepushkey hook.
210
215
211 $ cat >> .hg/hgrc <<EOF
216 $ cat >> .hg/hgrc <<EOF
212 > [hooks]
217 > [hooks]
213 > prepushkey = sh -c "printenv.py prepushkey 0"
218 > prepushkey = sh -c "printenv.py prepushkey 0"
214 > [devel]
215 > legacy.exchange=
216 > EOF
219 > EOF
217
220
218 #if bundle1
221 We don't need to test bundle1 because it succeeded above.
219
222
223 #if bundle2
220 $ req
224 $ req
221 pushing to http://localhost:$HGPORT/
225 pushing to http://localhost:$HGPORT/
222 searching for changes
226 searching for changes
223 no changes found
227 remote: adding changesets
228 remote: adding manifests
229 remote: adding file changes
230 remote: added 1 changesets with 1 changes to 1 files
231 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)
224 % serve errors
232 % serve errors
225 [1]
226 $ hg rollback
227 repository tip rolled back to revision 0 (undo serve)
228
229 #endif
233 #endif
230
234
231 #if bundle2
235 $ hg --config extensions.strip= strip -r 1:
236 saved backup bundle to $TESTTMP/test/.hg/strip-backup/ba677d0156c1-eea704d7-backup.hg
237
238 Now do a variant of the above, except on a non-publishing repository
232
239
240 $ cat >> .hg/hgrc <<EOF
241 > [phases]
242 > publish = false
243 > [hooks]
244 > prepushkey = sh -c "printenv.py prepushkey 1"
245 > EOF
246
247 #if bundle1
233 $ req
248 $ req
234 pushing to http://localhost:$HGPORT/
249 pushing to http://localhost:$HGPORT/
235 searching for changes
250 searching for changes
@@ -237,12 +252,61 b' expect phase change success'
237 remote: adding manifests
252 remote: adding manifests
238 remote: adding file changes
253 remote: adding file changes
239 remote: added 1 changesets with 1 changes to 1 files
254 remote: added 1 changesets with 1 changes to 1 files
255 remote: prepushkey hook: HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1
256 remote: pushkey-abort: prepushkey hook exited with status 1
257 updating ba677d0156c1 to public failed!
240 % serve errors
258 % serve errors
241 $ hg rollback
259 #endif
242 repository tip rolled back to revision 0 (undo serve)
260
261 #if bundle2
262 $ req
263 pushing to http://localhost:$HGPORT/
264 searching for changes
265 remote: adding changesets
266 remote: adding manifests
267 remote: adding file changes
268 remote: added 1 changesets with 1 changes to 1 files
269 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)
270 remote: pushkey-abort: prepushkey hook exited with status 1
271 remote: transaction abort!
272 remote: rollback completed
273 abort: updating ba677d0156c1 to public failed
274 % serve errors
275 [255]
276 #endif
277
278 Make phases updates work
243
279
280 $ cat >> .hg/hgrc <<EOF
281 > [hooks]
282 > prepushkey = sh -c "printenv.py prepushkey 0"
283 > EOF
284
285 #if bundle1
286 $ req
287 pushing to http://localhost:$HGPORT/
288 searching for changes
289 no changes found
290 remote: prepushkey hook: HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1
291 % serve errors
292 [1]
244 #endif
293 #endif
245
294
295 #if bundle2
296 $ req
297 pushing to http://localhost:$HGPORT/
298 searching for changes
299 remote: adding changesets
300 remote: adding manifests
301 remote: adding file changes
302 remote: added 1 changesets with 1 changes to 1 files
303 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)
304 % serve errors
305 #endif
306
307 $ hg --config extensions.strip= strip -r 1:
308 saved backup bundle to $TESTTMP/test/.hg/strip-backup/ba677d0156c1-eea704d7-backup.hg
309
246 expect authorization error: all users denied
310 expect authorization error: all users denied
247
311
248 $ echo '[web]' > .hg/hgrc
312 $ echo '[web]' > .hg/hgrc
General Comments 0
You need to be logged in to leave comments. Login now