##// END OF EJS Templates
tests: quote paths in shell script hooks...
Matt Harbison -
r31767:6c800688 default
parent child Browse files
Show More
@@ -1,953 +1,953 b''
1 $ hg init repo
1 $ hg init repo
2 $ cd repo
2 $ cd repo
3
3
4 no bookmarks
4 no bookmarks
5
5
6 $ hg bookmarks
6 $ hg bookmarks
7 no bookmarks set
7 no bookmarks set
8
8
9 $ hg bookmarks -Tjson
9 $ hg bookmarks -Tjson
10 [
10 [
11 ]
11 ]
12
12
13 bookmark rev -1
13 bookmark rev -1
14
14
15 $ hg bookmark X
15 $ hg bookmark X
16
16
17 list bookmarks
17 list bookmarks
18
18
19 $ hg bookmarks
19 $ hg bookmarks
20 * X -1:000000000000
20 * X -1:000000000000
21
21
22 list bookmarks with color
22 list bookmarks with color
23
23
24 $ hg --config extensions.color= --config color.mode=ansi \
24 $ hg --config extensions.color= --config color.mode=ansi \
25 > bookmarks --color=always
25 > bookmarks --color=always
26 \x1b[0;32m * \x1b[0m\x1b[0;32mX\x1b[0m\x1b[0;32m -1:000000000000\x1b[0m (esc)
26 \x1b[0;32m * \x1b[0m\x1b[0;32mX\x1b[0m\x1b[0;32m -1:000000000000\x1b[0m (esc)
27
27
28 $ echo a > a
28 $ echo a > a
29 $ hg add a
29 $ hg add a
30 $ hg commit -m 0
30 $ hg commit -m 0
31
31
32 bookmark X moved to rev 0
32 bookmark X moved to rev 0
33
33
34 $ hg bookmarks
34 $ hg bookmarks
35 * X 0:f7b1eb17ad24
35 * X 0:f7b1eb17ad24
36
36
37 look up bookmark
37 look up bookmark
38
38
39 $ hg log -r X
39 $ hg log -r X
40 changeset: 0:f7b1eb17ad24
40 changeset: 0:f7b1eb17ad24
41 bookmark: X
41 bookmark: X
42 tag: tip
42 tag: tip
43 user: test
43 user: test
44 date: Thu Jan 01 00:00:00 1970 +0000
44 date: Thu Jan 01 00:00:00 1970 +0000
45 summary: 0
45 summary: 0
46
46
47
47
48 second bookmark for rev 0, command should work even with ui.strict on
48 second bookmark for rev 0, command should work even with ui.strict on
49
49
50 $ hg --config ui.strict=1 bookmark X2
50 $ hg --config ui.strict=1 bookmark X2
51
51
52 bookmark rev -1 again
52 bookmark rev -1 again
53
53
54 $ hg bookmark -r null Y
54 $ hg bookmark -r null Y
55
55
56 list bookmarks
56 list bookmarks
57
57
58 $ hg bookmarks
58 $ hg bookmarks
59 X 0:f7b1eb17ad24
59 X 0:f7b1eb17ad24
60 * X2 0:f7b1eb17ad24
60 * X2 0:f7b1eb17ad24
61 Y -1:000000000000
61 Y -1:000000000000
62
62
63 $ echo b > b
63 $ echo b > b
64 $ hg add b
64 $ hg add b
65 $ hg commit -m 1
65 $ hg commit -m 1
66
66
67 $ hg bookmarks -Tjson
67 $ hg bookmarks -Tjson
68 [
68 [
69 {
69 {
70 "active": false,
70 "active": false,
71 "bookmark": "X",
71 "bookmark": "X",
72 "node": "f7b1eb17ad24730a1651fccd46c43826d1bbc2ac",
72 "node": "f7b1eb17ad24730a1651fccd46c43826d1bbc2ac",
73 "rev": 0
73 "rev": 0
74 },
74 },
75 {
75 {
76 "active": true,
76 "active": true,
77 "bookmark": "X2",
77 "bookmark": "X2",
78 "node": "925d80f479bb026b0fb3deb27503780b13f74123",
78 "node": "925d80f479bb026b0fb3deb27503780b13f74123",
79 "rev": 1
79 "rev": 1
80 },
80 },
81 {
81 {
82 "active": false,
82 "active": false,
83 "bookmark": "Y",
83 "bookmark": "Y",
84 "node": "0000000000000000000000000000000000000000",
84 "node": "0000000000000000000000000000000000000000",
85 "rev": -1
85 "rev": -1
86 }
86 }
87 ]
87 ]
88
88
89 bookmarks revset
89 bookmarks revset
90
90
91 $ hg log -r 'bookmark()'
91 $ hg log -r 'bookmark()'
92 changeset: 0:f7b1eb17ad24
92 changeset: 0:f7b1eb17ad24
93 bookmark: X
93 bookmark: X
94 user: test
94 user: test
95 date: Thu Jan 01 00:00:00 1970 +0000
95 date: Thu Jan 01 00:00:00 1970 +0000
96 summary: 0
96 summary: 0
97
97
98 changeset: 1:925d80f479bb
98 changeset: 1:925d80f479bb
99 bookmark: X2
99 bookmark: X2
100 tag: tip
100 tag: tip
101 user: test
101 user: test
102 date: Thu Jan 01 00:00:00 1970 +0000
102 date: Thu Jan 01 00:00:00 1970 +0000
103 summary: 1
103 summary: 1
104
104
105 $ hg log -r 'bookmark(Y)'
105 $ hg log -r 'bookmark(Y)'
106 $ hg log -r 'bookmark(X2)'
106 $ hg log -r 'bookmark(X2)'
107 changeset: 1:925d80f479bb
107 changeset: 1:925d80f479bb
108 bookmark: X2
108 bookmark: X2
109 tag: tip
109 tag: tip
110 user: test
110 user: test
111 date: Thu Jan 01 00:00:00 1970 +0000
111 date: Thu Jan 01 00:00:00 1970 +0000
112 summary: 1
112 summary: 1
113
113
114 $ hg log -r 'bookmark("re:X")'
114 $ hg log -r 'bookmark("re:X")'
115 changeset: 0:f7b1eb17ad24
115 changeset: 0:f7b1eb17ad24
116 bookmark: X
116 bookmark: X
117 user: test
117 user: test
118 date: Thu Jan 01 00:00:00 1970 +0000
118 date: Thu Jan 01 00:00:00 1970 +0000
119 summary: 0
119 summary: 0
120
120
121 changeset: 1:925d80f479bb
121 changeset: 1:925d80f479bb
122 bookmark: X2
122 bookmark: X2
123 tag: tip
123 tag: tip
124 user: test
124 user: test
125 date: Thu Jan 01 00:00:00 1970 +0000
125 date: Thu Jan 01 00:00:00 1970 +0000
126 summary: 1
126 summary: 1
127
127
128 $ hg log -r 'bookmark("literal:X")'
128 $ hg log -r 'bookmark("literal:X")'
129 changeset: 0:f7b1eb17ad24
129 changeset: 0:f7b1eb17ad24
130 bookmark: X
130 bookmark: X
131 user: test
131 user: test
132 date: Thu Jan 01 00:00:00 1970 +0000
132 date: Thu Jan 01 00:00:00 1970 +0000
133 summary: 0
133 summary: 0
134
134
135
135
136 $ hg log -r 'bookmark(unknown)'
136 $ hg log -r 'bookmark(unknown)'
137 abort: bookmark 'unknown' does not exist!
137 abort: bookmark 'unknown' does not exist!
138 [255]
138 [255]
139 $ hg log -r 'bookmark("literal:unknown")'
139 $ hg log -r 'bookmark("literal:unknown")'
140 abort: bookmark 'unknown' does not exist!
140 abort: bookmark 'unknown' does not exist!
141 [255]
141 [255]
142 $ hg log -r 'bookmark("re:unknown")'
142 $ hg log -r 'bookmark("re:unknown")'
143 abort: no bookmarks exist that match 'unknown'!
143 abort: no bookmarks exist that match 'unknown'!
144 [255]
144 [255]
145 $ hg log -r 'present(bookmark("literal:unknown"))'
145 $ hg log -r 'present(bookmark("literal:unknown"))'
146 $ hg log -r 'present(bookmark("re:unknown"))'
146 $ hg log -r 'present(bookmark("re:unknown"))'
147
147
148 $ hg help revsets | grep 'bookmark('
148 $ hg help revsets | grep 'bookmark('
149 "bookmark([name])"
149 "bookmark([name])"
150
150
151 bookmarks X and X2 moved to rev 1, Y at rev -1
151 bookmarks X and X2 moved to rev 1, Y at rev -1
152
152
153 $ hg bookmarks
153 $ hg bookmarks
154 X 0:f7b1eb17ad24
154 X 0:f7b1eb17ad24
155 * X2 1:925d80f479bb
155 * X2 1:925d80f479bb
156 Y -1:000000000000
156 Y -1:000000000000
157
157
158 bookmark rev 0 again
158 bookmark rev 0 again
159
159
160 $ hg bookmark -r 0 Z
160 $ hg bookmark -r 0 Z
161
161
162 $ hg update X
162 $ hg update X
163 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
163 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
164 (activating bookmark X)
164 (activating bookmark X)
165 $ echo c > c
165 $ echo c > c
166 $ hg add c
166 $ hg add c
167 $ hg commit -m 2
167 $ hg commit -m 2
168 created new head
168 created new head
169
169
170 bookmarks X moved to rev 2, Y at rev -1, Z at rev 0
170 bookmarks X moved to rev 2, Y at rev -1, Z at rev 0
171
171
172 $ hg bookmarks
172 $ hg bookmarks
173 * X 2:db815d6d32e6
173 * X 2:db815d6d32e6
174 X2 1:925d80f479bb
174 X2 1:925d80f479bb
175 Y -1:000000000000
175 Y -1:000000000000
176 Z 0:f7b1eb17ad24
176 Z 0:f7b1eb17ad24
177
177
178 rename nonexistent bookmark
178 rename nonexistent bookmark
179
179
180 $ hg bookmark -m A B
180 $ hg bookmark -m A B
181 abort: bookmark 'A' does not exist
181 abort: bookmark 'A' does not exist
182 [255]
182 [255]
183
183
184 rename to existent bookmark
184 rename to existent bookmark
185
185
186 $ hg bookmark -m X Y
186 $ hg bookmark -m X Y
187 abort: bookmark 'Y' already exists (use -f to force)
187 abort: bookmark 'Y' already exists (use -f to force)
188 [255]
188 [255]
189
189
190 force rename to existent bookmark
190 force rename to existent bookmark
191
191
192 $ hg bookmark -f -m X Y
192 $ hg bookmark -f -m X Y
193
193
194 list bookmarks
194 list bookmarks
195
195
196 $ hg bookmark
196 $ hg bookmark
197 X2 1:925d80f479bb
197 X2 1:925d80f479bb
198 * Y 2:db815d6d32e6
198 * Y 2:db815d6d32e6
199 Z 0:f7b1eb17ad24
199 Z 0:f7b1eb17ad24
200
200
201 bookmarks from a revset
201 bookmarks from a revset
202 $ hg bookmark -r '.^1' REVSET
202 $ hg bookmark -r '.^1' REVSET
203 $ hg bookmark -r ':tip' TIP
203 $ hg bookmark -r ':tip' TIP
204 $ hg up -q TIP
204 $ hg up -q TIP
205 $ hg bookmarks
205 $ hg bookmarks
206 REVSET 0:f7b1eb17ad24
206 REVSET 0:f7b1eb17ad24
207 * TIP 2:db815d6d32e6
207 * TIP 2:db815d6d32e6
208 X2 1:925d80f479bb
208 X2 1:925d80f479bb
209 Y 2:db815d6d32e6
209 Y 2:db815d6d32e6
210 Z 0:f7b1eb17ad24
210 Z 0:f7b1eb17ad24
211
211
212 $ hg bookmark -d REVSET
212 $ hg bookmark -d REVSET
213 $ hg bookmark -d TIP
213 $ hg bookmark -d TIP
214
214
215 rename without new name or multiple names
215 rename without new name or multiple names
216
216
217 $ hg bookmark -m Y
217 $ hg bookmark -m Y
218 abort: new bookmark name required
218 abort: new bookmark name required
219 [255]
219 [255]
220 $ hg bookmark -m Y Y2 Y3
220 $ hg bookmark -m Y Y2 Y3
221 abort: only one new bookmark name allowed
221 abort: only one new bookmark name allowed
222 [255]
222 [255]
223
223
224 delete without name
224 delete without name
225
225
226 $ hg bookmark -d
226 $ hg bookmark -d
227 abort: bookmark name required
227 abort: bookmark name required
228 [255]
228 [255]
229
229
230 delete nonexistent bookmark
230 delete nonexistent bookmark
231
231
232 $ hg bookmark -d A
232 $ hg bookmark -d A
233 abort: bookmark 'A' does not exist
233 abort: bookmark 'A' does not exist
234 [255]
234 [255]
235
235
236 bookmark name with spaces should be stripped
236 bookmark name with spaces should be stripped
237
237
238 $ hg bookmark ' x y '
238 $ hg bookmark ' x y '
239
239
240 list bookmarks
240 list bookmarks
241
241
242 $ hg bookmarks
242 $ hg bookmarks
243 X2 1:925d80f479bb
243 X2 1:925d80f479bb
244 Y 2:db815d6d32e6
244 Y 2:db815d6d32e6
245 Z 0:f7b1eb17ad24
245 Z 0:f7b1eb17ad24
246 * x y 2:db815d6d32e6
246 * x y 2:db815d6d32e6
247
247
248 look up stripped bookmark name
248 look up stripped bookmark name
249
249
250 $ hg log -r '"x y"'
250 $ hg log -r '"x y"'
251 changeset: 2:db815d6d32e6
251 changeset: 2:db815d6d32e6
252 bookmark: Y
252 bookmark: Y
253 bookmark: x y
253 bookmark: x y
254 tag: tip
254 tag: tip
255 parent: 0:f7b1eb17ad24
255 parent: 0:f7b1eb17ad24
256 user: test
256 user: test
257 date: Thu Jan 01 00:00:00 1970 +0000
257 date: Thu Jan 01 00:00:00 1970 +0000
258 summary: 2
258 summary: 2
259
259
260
260
261 reject bookmark name with newline
261 reject bookmark name with newline
262
262
263 $ hg bookmark '
263 $ hg bookmark '
264 > '
264 > '
265 abort: bookmark names cannot consist entirely of whitespace
265 abort: bookmark names cannot consist entirely of whitespace
266 [255]
266 [255]
267
267
268 $ hg bookmark -m Z '
268 $ hg bookmark -m Z '
269 > '
269 > '
270 abort: bookmark names cannot consist entirely of whitespace
270 abort: bookmark names cannot consist entirely of whitespace
271 [255]
271 [255]
272
272
273 bookmark with reserved name
273 bookmark with reserved name
274
274
275 $ hg bookmark tip
275 $ hg bookmark tip
276 abort: the name 'tip' is reserved
276 abort: the name 'tip' is reserved
277 [255]
277 [255]
278
278
279 $ hg bookmark .
279 $ hg bookmark .
280 abort: the name '.' is reserved
280 abort: the name '.' is reserved
281 [255]
281 [255]
282
282
283 $ hg bookmark null
283 $ hg bookmark null
284 abort: the name 'null' is reserved
284 abort: the name 'null' is reserved
285 [255]
285 [255]
286
286
287
287
288 bookmark with existing name
288 bookmark with existing name
289
289
290 $ hg bookmark X2
290 $ hg bookmark X2
291 abort: bookmark 'X2' already exists (use -f to force)
291 abort: bookmark 'X2' already exists (use -f to force)
292 [255]
292 [255]
293
293
294 $ hg bookmark -m Y Z
294 $ hg bookmark -m Y Z
295 abort: bookmark 'Z' already exists (use -f to force)
295 abort: bookmark 'Z' already exists (use -f to force)
296 [255]
296 [255]
297
297
298 bookmark with name of branch
298 bookmark with name of branch
299
299
300 $ hg bookmark default
300 $ hg bookmark default
301 abort: a bookmark cannot have the name of an existing branch
301 abort: a bookmark cannot have the name of an existing branch
302 [255]
302 [255]
303
303
304 $ hg bookmark -m Y default
304 $ hg bookmark -m Y default
305 abort: a bookmark cannot have the name of an existing branch
305 abort: a bookmark cannot have the name of an existing branch
306 [255]
306 [255]
307
307
308 bookmark with integer name
308 bookmark with integer name
309
309
310 $ hg bookmark 10
310 $ hg bookmark 10
311 abort: cannot use an integer as a name
311 abort: cannot use an integer as a name
312 [255]
312 [255]
313
313
314 incompatible options
314 incompatible options
315
315
316 $ hg bookmark -m Y -d Z
316 $ hg bookmark -m Y -d Z
317 abort: --delete and --rename are incompatible
317 abort: --delete and --rename are incompatible
318 [255]
318 [255]
319
319
320 $ hg bookmark -r 1 -d Z
320 $ hg bookmark -r 1 -d Z
321 abort: --rev is incompatible with --delete
321 abort: --rev is incompatible with --delete
322 [255]
322 [255]
323
323
324 $ hg bookmark -r 1 -m Z Y
324 $ hg bookmark -r 1 -m Z Y
325 abort: --rev is incompatible with --rename
325 abort: --rev is incompatible with --rename
326 [255]
326 [255]
327
327
328 force bookmark with existing name
328 force bookmark with existing name
329
329
330 $ hg bookmark -f X2
330 $ hg bookmark -f X2
331
331
332 force bookmark back to where it was, should deactivate it
332 force bookmark back to where it was, should deactivate it
333
333
334 $ hg bookmark -fr1 X2
334 $ hg bookmark -fr1 X2
335 $ hg bookmarks
335 $ hg bookmarks
336 X2 1:925d80f479bb
336 X2 1:925d80f479bb
337 Y 2:db815d6d32e6
337 Y 2:db815d6d32e6
338 Z 0:f7b1eb17ad24
338 Z 0:f7b1eb17ad24
339 x y 2:db815d6d32e6
339 x y 2:db815d6d32e6
340
340
341 forward bookmark to descendant without --force
341 forward bookmark to descendant without --force
342
342
343 $ hg bookmark Z
343 $ hg bookmark Z
344 moving bookmark 'Z' forward from f7b1eb17ad24
344 moving bookmark 'Z' forward from f7b1eb17ad24
345
345
346 list bookmarks
346 list bookmarks
347
347
348 $ hg bookmark
348 $ hg bookmark
349 X2 1:925d80f479bb
349 X2 1:925d80f479bb
350 Y 2:db815d6d32e6
350 Y 2:db815d6d32e6
351 * Z 2:db815d6d32e6
351 * Z 2:db815d6d32e6
352 x y 2:db815d6d32e6
352 x y 2:db815d6d32e6
353
353
354 revision but no bookmark name
354 revision but no bookmark name
355
355
356 $ hg bookmark -r .
356 $ hg bookmark -r .
357 abort: bookmark name required
357 abort: bookmark name required
358 [255]
358 [255]
359
359
360 bookmark name with whitespace only
360 bookmark name with whitespace only
361
361
362 $ hg bookmark ' '
362 $ hg bookmark ' '
363 abort: bookmark names cannot consist entirely of whitespace
363 abort: bookmark names cannot consist entirely of whitespace
364 [255]
364 [255]
365
365
366 $ hg bookmark -m Y ' '
366 $ hg bookmark -m Y ' '
367 abort: bookmark names cannot consist entirely of whitespace
367 abort: bookmark names cannot consist entirely of whitespace
368 [255]
368 [255]
369
369
370 invalid bookmark
370 invalid bookmark
371
371
372 $ hg bookmark 'foo:bar'
372 $ hg bookmark 'foo:bar'
373 abort: ':' cannot be used in a name
373 abort: ':' cannot be used in a name
374 [255]
374 [255]
375
375
376 $ hg bookmark 'foo
376 $ hg bookmark 'foo
377 > bar'
377 > bar'
378 abort: '\n' cannot be used in a name
378 abort: '\n' cannot be used in a name
379 [255]
379 [255]
380
380
381 the bookmark extension should be ignored now that it is part of core
381 the bookmark extension should be ignored now that it is part of core
382
382
383 $ echo "[extensions]" >> $HGRCPATH
383 $ echo "[extensions]" >> $HGRCPATH
384 $ echo "bookmarks=" >> $HGRCPATH
384 $ echo "bookmarks=" >> $HGRCPATH
385 $ hg bookmarks
385 $ hg bookmarks
386 X2 1:925d80f479bb
386 X2 1:925d80f479bb
387 Y 2:db815d6d32e6
387 Y 2:db815d6d32e6
388 * Z 2:db815d6d32e6
388 * Z 2:db815d6d32e6
389 x y 2:db815d6d32e6
389 x y 2:db815d6d32e6
390
390
391 test summary
391 test summary
392
392
393 $ hg summary
393 $ hg summary
394 parent: 2:db815d6d32e6 tip
394 parent: 2:db815d6d32e6 tip
395 2
395 2
396 branch: default
396 branch: default
397 bookmarks: *Z Y x y
397 bookmarks: *Z Y x y
398 commit: (clean)
398 commit: (clean)
399 update: 1 new changesets, 2 branch heads (merge)
399 update: 1 new changesets, 2 branch heads (merge)
400 phases: 3 draft
400 phases: 3 draft
401
401
402 test id
402 test id
403
403
404 $ hg id
404 $ hg id
405 db815d6d32e6 tip Y/Z/x y
405 db815d6d32e6 tip Y/Z/x y
406
406
407 test rollback
407 test rollback
408
408
409 $ echo foo > f1
409 $ echo foo > f1
410 $ hg bookmark tmp-rollback
410 $ hg bookmark tmp-rollback
411 $ hg ci -Amr
411 $ hg ci -Amr
412 adding f1
412 adding f1
413 $ hg bookmarks
413 $ hg bookmarks
414 X2 1:925d80f479bb
414 X2 1:925d80f479bb
415 Y 2:db815d6d32e6
415 Y 2:db815d6d32e6
416 Z 2:db815d6d32e6
416 Z 2:db815d6d32e6
417 * tmp-rollback 3:2bf5cfec5864
417 * tmp-rollback 3:2bf5cfec5864
418 x y 2:db815d6d32e6
418 x y 2:db815d6d32e6
419 $ hg rollback
419 $ hg rollback
420 repository tip rolled back to revision 2 (undo commit)
420 repository tip rolled back to revision 2 (undo commit)
421 working directory now based on revision 2
421 working directory now based on revision 2
422 $ hg bookmarks
422 $ hg bookmarks
423 X2 1:925d80f479bb
423 X2 1:925d80f479bb
424 Y 2:db815d6d32e6
424 Y 2:db815d6d32e6
425 Z 2:db815d6d32e6
425 Z 2:db815d6d32e6
426 * tmp-rollback 2:db815d6d32e6
426 * tmp-rollback 2:db815d6d32e6
427 x y 2:db815d6d32e6
427 x y 2:db815d6d32e6
428 $ hg bookmark -f Z -r 1
428 $ hg bookmark -f Z -r 1
429 $ hg rollback
429 $ hg rollback
430 repository tip rolled back to revision 2 (undo bookmark)
430 repository tip rolled back to revision 2 (undo bookmark)
431 $ hg bookmarks
431 $ hg bookmarks
432 X2 1:925d80f479bb
432 X2 1:925d80f479bb
433 Y 2:db815d6d32e6
433 Y 2:db815d6d32e6
434 Z 2:db815d6d32e6
434 Z 2:db815d6d32e6
435 * tmp-rollback 2:db815d6d32e6
435 * tmp-rollback 2:db815d6d32e6
436 x y 2:db815d6d32e6
436 x y 2:db815d6d32e6
437 $ hg bookmark -d tmp-rollback
437 $ hg bookmark -d tmp-rollback
438
438
439 activate bookmark on working dir parent without --force
439 activate bookmark on working dir parent without --force
440
440
441 $ hg bookmark --inactive Z
441 $ hg bookmark --inactive Z
442 $ hg bookmark Z
442 $ hg bookmark Z
443
443
444 test clone
444 test clone
445
445
446 $ hg bookmark -r 2 -i @
446 $ hg bookmark -r 2 -i @
447 $ hg bookmark -r 2 -i a@
447 $ hg bookmark -r 2 -i a@
448 $ hg bookmarks
448 $ hg bookmarks
449 @ 2:db815d6d32e6
449 @ 2:db815d6d32e6
450 X2 1:925d80f479bb
450 X2 1:925d80f479bb
451 Y 2:db815d6d32e6
451 Y 2:db815d6d32e6
452 * Z 2:db815d6d32e6
452 * Z 2:db815d6d32e6
453 a@ 2:db815d6d32e6
453 a@ 2:db815d6d32e6
454 x y 2:db815d6d32e6
454 x y 2:db815d6d32e6
455 $ hg clone . cloned-bookmarks
455 $ hg clone . cloned-bookmarks
456 updating to bookmark @
456 updating to bookmark @
457 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
457 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
458 $ hg -R cloned-bookmarks bookmarks
458 $ hg -R cloned-bookmarks bookmarks
459 * @ 2:db815d6d32e6
459 * @ 2:db815d6d32e6
460 X2 1:925d80f479bb
460 X2 1:925d80f479bb
461 Y 2:db815d6d32e6
461 Y 2:db815d6d32e6
462 Z 2:db815d6d32e6
462 Z 2:db815d6d32e6
463 a@ 2:db815d6d32e6
463 a@ 2:db815d6d32e6
464 x y 2:db815d6d32e6
464 x y 2:db815d6d32e6
465
465
466 test clone with pull protocol
466 test clone with pull protocol
467
467
468 $ hg clone --pull . cloned-bookmarks-pull
468 $ hg clone --pull . cloned-bookmarks-pull
469 requesting all changes
469 requesting all changes
470 adding changesets
470 adding changesets
471 adding manifests
471 adding manifests
472 adding file changes
472 adding file changes
473 added 3 changesets with 3 changes to 3 files (+1 heads)
473 added 3 changesets with 3 changes to 3 files (+1 heads)
474 updating to bookmark @
474 updating to bookmark @
475 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
475 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
476 $ hg -R cloned-bookmarks-pull bookmarks
476 $ hg -R cloned-bookmarks-pull bookmarks
477 * @ 2:db815d6d32e6
477 * @ 2:db815d6d32e6
478 X2 1:925d80f479bb
478 X2 1:925d80f479bb
479 Y 2:db815d6d32e6
479 Y 2:db815d6d32e6
480 Z 2:db815d6d32e6
480 Z 2:db815d6d32e6
481 a@ 2:db815d6d32e6
481 a@ 2:db815d6d32e6
482 x y 2:db815d6d32e6
482 x y 2:db815d6d32e6
483
483
484 delete multiple bookmarks at once
484 delete multiple bookmarks at once
485
485
486 $ hg bookmark -d @ a@
486 $ hg bookmark -d @ a@
487
487
488 test clone with a bookmark named "default" (issue3677)
488 test clone with a bookmark named "default" (issue3677)
489
489
490 $ hg bookmark -r 1 -f -i default
490 $ hg bookmark -r 1 -f -i default
491 $ hg clone . cloned-bookmark-default
491 $ hg clone . cloned-bookmark-default
492 updating to branch default
492 updating to branch default
493 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
493 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
494 $ hg -R cloned-bookmark-default bookmarks
494 $ hg -R cloned-bookmark-default bookmarks
495 X2 1:925d80f479bb
495 X2 1:925d80f479bb
496 Y 2:db815d6d32e6
496 Y 2:db815d6d32e6
497 Z 2:db815d6d32e6
497 Z 2:db815d6d32e6
498 default 1:925d80f479bb
498 default 1:925d80f479bb
499 x y 2:db815d6d32e6
499 x y 2:db815d6d32e6
500 $ hg -R cloned-bookmark-default parents -q
500 $ hg -R cloned-bookmark-default parents -q
501 2:db815d6d32e6
501 2:db815d6d32e6
502 $ hg bookmark -d default
502 $ hg bookmark -d default
503
503
504 test clone with a specific revision
504 test clone with a specific revision
505
505
506 $ hg clone -r 925d80 . cloned-bookmarks-rev
506 $ hg clone -r 925d80 . cloned-bookmarks-rev
507 adding changesets
507 adding changesets
508 adding manifests
508 adding manifests
509 adding file changes
509 adding file changes
510 added 2 changesets with 2 changes to 2 files
510 added 2 changesets with 2 changes to 2 files
511 updating to branch default
511 updating to branch default
512 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
512 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
513 $ hg -R cloned-bookmarks-rev bookmarks
513 $ hg -R cloned-bookmarks-rev bookmarks
514 X2 1:925d80f479bb
514 X2 1:925d80f479bb
515
515
516 test clone with update to a bookmark
516 test clone with update to a bookmark
517
517
518 $ hg clone -u Z . ../cloned-bookmarks-update
518 $ hg clone -u Z . ../cloned-bookmarks-update
519 updating to branch default
519 updating to branch default
520 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
520 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
521 $ hg -R ../cloned-bookmarks-update bookmarks
521 $ hg -R ../cloned-bookmarks-update bookmarks
522 X2 1:925d80f479bb
522 X2 1:925d80f479bb
523 Y 2:db815d6d32e6
523 Y 2:db815d6d32e6
524 * Z 2:db815d6d32e6
524 * Z 2:db815d6d32e6
525 x y 2:db815d6d32e6
525 x y 2:db815d6d32e6
526
526
527 create bundle with two heads
527 create bundle with two heads
528
528
529 $ hg clone . tobundle
529 $ hg clone . tobundle
530 updating to branch default
530 updating to branch default
531 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
531 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
532 $ echo x > tobundle/x
532 $ echo x > tobundle/x
533 $ hg -R tobundle add tobundle/x
533 $ hg -R tobundle add tobundle/x
534 $ hg -R tobundle commit -m'x'
534 $ hg -R tobundle commit -m'x'
535 $ hg -R tobundle update -r -2
535 $ hg -R tobundle update -r -2
536 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
536 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
537 $ echo y > tobundle/y
537 $ echo y > tobundle/y
538 $ hg -R tobundle branch test
538 $ hg -R tobundle branch test
539 marked working directory as branch test
539 marked working directory as branch test
540 (branches are permanent and global, did you want a bookmark?)
540 (branches are permanent and global, did you want a bookmark?)
541 $ hg -R tobundle add tobundle/y
541 $ hg -R tobundle add tobundle/y
542 $ hg -R tobundle commit -m'y'
542 $ hg -R tobundle commit -m'y'
543 $ hg -R tobundle bundle tobundle.hg
543 $ hg -R tobundle bundle tobundle.hg
544 searching for changes
544 searching for changes
545 2 changesets found
545 2 changesets found
546 $ hg unbundle tobundle.hg
546 $ hg unbundle tobundle.hg
547 adding changesets
547 adding changesets
548 adding manifests
548 adding manifests
549 adding file changes
549 adding file changes
550 added 2 changesets with 2 changes to 2 files (+1 heads)
550 added 2 changesets with 2 changes to 2 files (+1 heads)
551 (run 'hg heads' to see heads, 'hg merge' to merge)
551 (run 'hg heads' to see heads, 'hg merge' to merge)
552
552
553 update to active bookmark if it's not the parent
553 update to active bookmark if it's not the parent
554
554
555 $ hg summary
555 $ hg summary
556 parent: 2:db815d6d32e6
556 parent: 2:db815d6d32e6
557 2
557 2
558 branch: default
558 branch: default
559 bookmarks: *Z Y x y
559 bookmarks: *Z Y x y
560 commit: 1 added, 1 unknown (new branch head)
560 commit: 1 added, 1 unknown (new branch head)
561 update: 2 new changesets (update)
561 update: 2 new changesets (update)
562 phases: 5 draft
562 phases: 5 draft
563 $ hg update
563 $ hg update
564 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
564 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
565 updating bookmark Z
565 updating bookmark Z
566 $ hg bookmarks
566 $ hg bookmarks
567 X2 1:925d80f479bb
567 X2 1:925d80f479bb
568 Y 2:db815d6d32e6
568 Y 2:db815d6d32e6
569 * Z 3:125c9a1d6df6
569 * Z 3:125c9a1d6df6
570 x y 2:db815d6d32e6
570 x y 2:db815d6d32e6
571
571
572 pull --update works the same as pull && update
572 pull --update works the same as pull && update
573
573
574 $ hg bookmark -r3 Y
574 $ hg bookmark -r3 Y
575 moving bookmark 'Y' forward from db815d6d32e6
575 moving bookmark 'Y' forward from db815d6d32e6
576 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
576 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
577 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence
577 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence
578
578
579 (manual version)
579 (manual version)
580
580
581 $ hg -R ../cloned-bookmarks-manual-update update Y
581 $ hg -R ../cloned-bookmarks-manual-update update Y
582 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
582 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
583 (activating bookmark Y)
583 (activating bookmark Y)
584 $ hg -R ../cloned-bookmarks-manual-update pull .
584 $ hg -R ../cloned-bookmarks-manual-update pull .
585 pulling from .
585 pulling from .
586 searching for changes
586 searching for changes
587 adding changesets
587 adding changesets
588 adding manifests
588 adding manifests
589 adding file changes
589 adding file changes
590 added 2 changesets with 2 changes to 2 files (+1 heads)
590 added 2 changesets with 2 changes to 2 files (+1 heads)
591 updating bookmark Y
591 updating bookmark Y
592 updating bookmark Z
592 updating bookmark Z
593 (run 'hg heads' to see heads, 'hg merge' to merge)
593 (run 'hg heads' to see heads, 'hg merge' to merge)
594
594
595 (# tests strange but with --date crashing when bookmark have to move)
595 (# tests strange but with --date crashing when bookmark have to move)
596
596
597 $ hg -R ../cloned-bookmarks-manual-update update -d 1986
597 $ hg -R ../cloned-bookmarks-manual-update update -d 1986
598 abort: revision matching date not found
598 abort: revision matching date not found
599 [255]
599 [255]
600 $ hg -R ../cloned-bookmarks-manual-update update
600 $ hg -R ../cloned-bookmarks-manual-update update
601 updating to active bookmark Y
601 updating to active bookmark Y
602 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
602 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
603
603
604 (all in one version)
604 (all in one version)
605
605
606 $ hg -R ../cloned-bookmarks-update update Y
606 $ hg -R ../cloned-bookmarks-update update Y
607 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
607 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
608 (activating bookmark Y)
608 (activating bookmark Y)
609 $ hg -R ../cloned-bookmarks-update pull --update .
609 $ hg -R ../cloned-bookmarks-update pull --update .
610 pulling from .
610 pulling from .
611 searching for changes
611 searching for changes
612 adding changesets
612 adding changesets
613 adding manifests
613 adding manifests
614 adding file changes
614 adding file changes
615 added 2 changesets with 2 changes to 2 files (+1 heads)
615 added 2 changesets with 2 changes to 2 files (+1 heads)
616 updating bookmark Y
616 updating bookmark Y
617 updating bookmark Z
617 updating bookmark Z
618 updating to active bookmark Y
618 updating to active bookmark Y
619 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
619 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
620
620
621 We warn about divergent during bare update to the active bookmark
621 We warn about divergent during bare update to the active bookmark
622
622
623 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update Y
623 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update Y
624 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
624 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
625 (activating bookmark Y)
625 (activating bookmark Y)
626 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks -r X2 Y@1
626 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks -r X2 Y@1
627 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks
627 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks
628 X2 1:925d80f479bb
628 X2 1:925d80f479bb
629 * Y 2:db815d6d32e6
629 * Y 2:db815d6d32e6
630 Y@1 1:925d80f479bb
630 Y@1 1:925d80f479bb
631 Z 2:db815d6d32e6
631 Z 2:db815d6d32e6
632 x y 2:db815d6d32e6
632 x y 2:db815d6d32e6
633 $ hg -R ../cloned-bookmarks-manual-update-with-divergence pull
633 $ hg -R ../cloned-bookmarks-manual-update-with-divergence pull
634 pulling from $TESTTMP/repo (glob)
634 pulling from $TESTTMP/repo (glob)
635 searching for changes
635 searching for changes
636 adding changesets
636 adding changesets
637 adding manifests
637 adding manifests
638 adding file changes
638 adding file changes
639 added 2 changesets with 2 changes to 2 files (+1 heads)
639 added 2 changesets with 2 changes to 2 files (+1 heads)
640 updating bookmark Y
640 updating bookmark Y
641 updating bookmark Z
641 updating bookmark Z
642 (run 'hg heads' to see heads, 'hg merge' to merge)
642 (run 'hg heads' to see heads, 'hg merge' to merge)
643 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update
643 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update
644 updating to active bookmark Y
644 updating to active bookmark Y
645 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
645 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 1 other divergent bookmarks for "Y"
646 1 other divergent bookmarks for "Y"
647
647
648 test wrongly formated bookmark
648 test wrongly formated bookmark
649
649
650 $ echo '' >> .hg/bookmarks
650 $ echo '' >> .hg/bookmarks
651 $ hg bookmarks
651 $ hg bookmarks
652 X2 1:925d80f479bb
652 X2 1:925d80f479bb
653 Y 3:125c9a1d6df6
653 Y 3:125c9a1d6df6
654 * Z 3:125c9a1d6df6
654 * Z 3:125c9a1d6df6
655 x y 2:db815d6d32e6
655 x y 2:db815d6d32e6
656 $ echo "Ican'thasformatedlines" >> .hg/bookmarks
656 $ echo "Ican'thasformatedlines" >> .hg/bookmarks
657 $ hg bookmarks
657 $ hg bookmarks
658 malformed line in .hg/bookmarks: "Ican'thasformatedlines"
658 malformed line in .hg/bookmarks: "Ican'thasformatedlines"
659 X2 1:925d80f479bb
659 X2 1:925d80f479bb
660 Y 3:125c9a1d6df6
660 Y 3:125c9a1d6df6
661 * Z 3:125c9a1d6df6
661 * Z 3:125c9a1d6df6
662 x y 2:db815d6d32e6
662 x y 2:db815d6d32e6
663
663
664 test missing revisions
664 test missing revisions
665
665
666 $ echo "925d80f479bc z" > .hg/bookmarks
666 $ echo "925d80f479bc z" > .hg/bookmarks
667 $ hg book
667 $ hg book
668 no bookmarks set
668 no bookmarks set
669
669
670 test stripping a non-checked-out but bookmarked revision
670 test stripping a non-checked-out but bookmarked revision
671
671
672 $ hg log --graph
672 $ hg log --graph
673 o changeset: 4:9ba5f110a0b3
673 o changeset: 4:9ba5f110a0b3
674 | branch: test
674 | branch: test
675 | tag: tip
675 | tag: tip
676 | parent: 2:db815d6d32e6
676 | parent: 2:db815d6d32e6
677 | user: test
677 | user: test
678 | date: Thu Jan 01 00:00:00 1970 +0000
678 | date: Thu Jan 01 00:00:00 1970 +0000
679 | summary: y
679 | summary: y
680 |
680 |
681 | @ changeset: 3:125c9a1d6df6
681 | @ changeset: 3:125c9a1d6df6
682 |/ user: test
682 |/ user: test
683 | date: Thu Jan 01 00:00:00 1970 +0000
683 | date: Thu Jan 01 00:00:00 1970 +0000
684 | summary: x
684 | summary: x
685 |
685 |
686 o changeset: 2:db815d6d32e6
686 o changeset: 2:db815d6d32e6
687 | parent: 0:f7b1eb17ad24
687 | parent: 0:f7b1eb17ad24
688 | user: test
688 | user: test
689 | date: Thu Jan 01 00:00:00 1970 +0000
689 | date: Thu Jan 01 00:00:00 1970 +0000
690 | summary: 2
690 | summary: 2
691 |
691 |
692 | o changeset: 1:925d80f479bb
692 | o changeset: 1:925d80f479bb
693 |/ user: test
693 |/ user: test
694 | date: Thu Jan 01 00:00:00 1970 +0000
694 | date: Thu Jan 01 00:00:00 1970 +0000
695 | summary: 1
695 | summary: 1
696 |
696 |
697 o changeset: 0:f7b1eb17ad24
697 o changeset: 0:f7b1eb17ad24
698 user: test
698 user: test
699 date: Thu Jan 01 00:00:00 1970 +0000
699 date: Thu Jan 01 00:00:00 1970 +0000
700 summary: 0
700 summary: 0
701
701
702 $ hg book should-end-on-two
702 $ hg book should-end-on-two
703 $ hg co --clean 4
703 $ hg co --clean 4
704 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
704 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
705 (leaving bookmark should-end-on-two)
705 (leaving bookmark should-end-on-two)
706 $ hg book four
706 $ hg book four
707 $ hg --config extensions.mq= strip 3
707 $ hg --config extensions.mq= strip 3
708 saved backup bundle to * (glob)
708 saved backup bundle to * (glob)
709 should-end-on-two should end up pointing to revision 2, as that's the
709 should-end-on-two should end up pointing to revision 2, as that's the
710 tipmost surviving ancestor of the stripped revision.
710 tipmost surviving ancestor of the stripped revision.
711 $ hg log --graph
711 $ hg log --graph
712 @ changeset: 3:9ba5f110a0b3
712 @ changeset: 3:9ba5f110a0b3
713 | branch: test
713 | branch: test
714 | bookmark: four
714 | bookmark: four
715 | tag: tip
715 | tag: tip
716 | user: test
716 | user: test
717 | date: Thu Jan 01 00:00:00 1970 +0000
717 | date: Thu Jan 01 00:00:00 1970 +0000
718 | summary: y
718 | summary: y
719 |
719 |
720 o changeset: 2:db815d6d32e6
720 o changeset: 2:db815d6d32e6
721 | bookmark: should-end-on-two
721 | bookmark: should-end-on-two
722 | parent: 0:f7b1eb17ad24
722 | parent: 0:f7b1eb17ad24
723 | user: test
723 | user: test
724 | date: Thu Jan 01 00:00:00 1970 +0000
724 | date: Thu Jan 01 00:00:00 1970 +0000
725 | summary: 2
725 | summary: 2
726 |
726 |
727 | o changeset: 1:925d80f479bb
727 | o changeset: 1:925d80f479bb
728 |/ user: test
728 |/ user: test
729 | date: Thu Jan 01 00:00:00 1970 +0000
729 | date: Thu Jan 01 00:00:00 1970 +0000
730 | summary: 1
730 | summary: 1
731 |
731 |
732 o changeset: 0:f7b1eb17ad24
732 o changeset: 0:f7b1eb17ad24
733 user: test
733 user: test
734 date: Thu Jan 01 00:00:00 1970 +0000
734 date: Thu Jan 01 00:00:00 1970 +0000
735 summary: 0
735 summary: 0
736
736
737
737
738 no-op update doesn't deactivate bookmarks
738 no-op update doesn't deactivate bookmarks
739
739
740 $ hg bookmarks
740 $ hg bookmarks
741 * four 3:9ba5f110a0b3
741 * four 3:9ba5f110a0b3
742 should-end-on-two 2:db815d6d32e6
742 should-end-on-two 2:db815d6d32e6
743 $ hg up four
743 $ hg up four
744 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
744 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
745 $ hg up
745 $ hg up
746 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
746 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
747 $ hg sum
747 $ hg sum
748 parent: 3:9ba5f110a0b3 tip
748 parent: 3:9ba5f110a0b3 tip
749 y
749 y
750 branch: test
750 branch: test
751 bookmarks: *four
751 bookmarks: *four
752 commit: 2 unknown (clean)
752 commit: 2 unknown (clean)
753 update: (current)
753 update: (current)
754 phases: 4 draft
754 phases: 4 draft
755
755
756 test clearing divergent bookmarks of linear ancestors
756 test clearing divergent bookmarks of linear ancestors
757
757
758 $ hg bookmark Z -r 0
758 $ hg bookmark Z -r 0
759 $ hg bookmark Z@1 -r 1
759 $ hg bookmark Z@1 -r 1
760 $ hg bookmark Z@2 -r 2
760 $ hg bookmark Z@2 -r 2
761 $ hg bookmark Z@3 -r 3
761 $ hg bookmark Z@3 -r 3
762 $ hg book
762 $ hg book
763 Z 0:f7b1eb17ad24
763 Z 0:f7b1eb17ad24
764 Z@1 1:925d80f479bb
764 Z@1 1:925d80f479bb
765 Z@2 2:db815d6d32e6
765 Z@2 2:db815d6d32e6
766 Z@3 3:9ba5f110a0b3
766 Z@3 3:9ba5f110a0b3
767 * four 3:9ba5f110a0b3
767 * four 3:9ba5f110a0b3
768 should-end-on-two 2:db815d6d32e6
768 should-end-on-two 2:db815d6d32e6
769 $ hg bookmark Z
769 $ hg bookmark Z
770 moving bookmark 'Z' forward from f7b1eb17ad24
770 moving bookmark 'Z' forward from f7b1eb17ad24
771 $ hg book
771 $ hg book
772 * Z 3:9ba5f110a0b3
772 * Z 3:9ba5f110a0b3
773 Z@1 1:925d80f479bb
773 Z@1 1:925d80f479bb
774 four 3:9ba5f110a0b3
774 four 3:9ba5f110a0b3
775 should-end-on-two 2:db815d6d32e6
775 should-end-on-two 2:db815d6d32e6
776
776
777 test clearing only a single divergent bookmark across branches
777 test clearing only a single divergent bookmark across branches
778
778
779 $ hg book foo -r 1
779 $ hg book foo -r 1
780 $ hg book foo@1 -r 0
780 $ hg book foo@1 -r 0
781 $ hg book foo@2 -r 2
781 $ hg book foo@2 -r 2
782 $ hg book foo@3 -r 3
782 $ hg book foo@3 -r 3
783 $ hg book foo -r foo@3
783 $ hg book foo -r foo@3
784 $ hg book
784 $ hg book
785 * Z 3:9ba5f110a0b3
785 * Z 3:9ba5f110a0b3
786 Z@1 1:925d80f479bb
786 Z@1 1:925d80f479bb
787 foo 3:9ba5f110a0b3
787 foo 3:9ba5f110a0b3
788 foo@1 0:f7b1eb17ad24
788 foo@1 0:f7b1eb17ad24
789 foo@2 2:db815d6d32e6
789 foo@2 2:db815d6d32e6
790 four 3:9ba5f110a0b3
790 four 3:9ba5f110a0b3
791 should-end-on-two 2:db815d6d32e6
791 should-end-on-two 2:db815d6d32e6
792
792
793 pull --update works the same as pull && update (case #2)
793 pull --update works the same as pull && update (case #2)
794
794
795 It is assumed that "hg pull" itself doesn't update current active
795 It is assumed that "hg pull" itself doesn't update current active
796 bookmark ('Y' in tests below).
796 bookmark ('Y' in tests below).
797
797
798 $ hg pull -q ../cloned-bookmarks-update
798 $ hg pull -q ../cloned-bookmarks-update
799 divergent bookmark Z stored as Z@2
799 divergent bookmark Z stored as Z@2
800
800
801 (pulling revision on another named branch with --update updates
801 (pulling revision on another named branch with --update updates
802 neither the working directory nor current active bookmark: "no-op"
802 neither the working directory nor current active bookmark: "no-op"
803 case)
803 case)
804
804
805 $ echo yy >> y
805 $ echo yy >> y
806 $ hg commit -m yy
806 $ hg commit -m yy
807
807
808 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
808 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
809 * Y 3:125c9a1d6df6
809 * Y 3:125c9a1d6df6
810 $ hg -R ../cloned-bookmarks-update pull . --update
810 $ hg -R ../cloned-bookmarks-update pull . --update
811 pulling from .
811 pulling from .
812 searching for changes
812 searching for changes
813 adding changesets
813 adding changesets
814 adding manifests
814 adding manifests
815 adding file changes
815 adding file changes
816 added 1 changesets with 1 changes to 1 files
816 added 1 changesets with 1 changes to 1 files
817 divergent bookmark Z stored as Z@default
817 divergent bookmark Z stored as Z@default
818 adding remote bookmark foo
818 adding remote bookmark foo
819 adding remote bookmark four
819 adding remote bookmark four
820 adding remote bookmark should-end-on-two
820 adding remote bookmark should-end-on-two
821 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
821 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
822 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
822 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
823 3:125c9a1d6df6
823 3:125c9a1d6df6
824 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
824 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
825 * Y 3:125c9a1d6df6
825 * Y 3:125c9a1d6df6
826
826
827 (pulling revision on current named/topological branch with --update
827 (pulling revision on current named/topological branch with --update
828 updates the working directory and current active bookmark)
828 updates the working directory and current active bookmark)
829
829
830 $ hg update -C -q 125c9a1d6df6
830 $ hg update -C -q 125c9a1d6df6
831 $ echo xx >> x
831 $ echo xx >> x
832 $ hg commit -m xx
832 $ hg commit -m xx
833
833
834 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
834 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
835 * Y 3:125c9a1d6df6
835 * Y 3:125c9a1d6df6
836 $ hg -R ../cloned-bookmarks-update pull . --update
836 $ hg -R ../cloned-bookmarks-update pull . --update
837 pulling from .
837 pulling from .
838 searching for changes
838 searching for changes
839 adding changesets
839 adding changesets
840 adding manifests
840 adding manifests
841 adding file changes
841 adding file changes
842 added 1 changesets with 1 changes to 1 files
842 added 1 changesets with 1 changes to 1 files
843 divergent bookmark Z stored as Z@default
843 divergent bookmark Z stored as Z@default
844 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
844 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
845 updating bookmark Y
845 updating bookmark Y
846 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
846 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
847 6:81dcce76aa0b
847 6:81dcce76aa0b
848 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
848 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
849 * Y 6:81dcce76aa0b
849 * Y 6:81dcce76aa0b
850
850
851 $ cd ..
851 $ cd ..
852
852
853 ensure changelog is written before bookmarks
853 ensure changelog is written before bookmarks
854 $ hg init orderrepo
854 $ hg init orderrepo
855 $ cd orderrepo
855 $ cd orderrepo
856 $ touch a
856 $ touch a
857 $ hg commit -Aqm one
857 $ hg commit -Aqm one
858 $ hg book mybook
858 $ hg book mybook
859 $ echo a > a
859 $ echo a > a
860
860
861 $ cat > $TESTTMP/pausefinalize.py <<EOF
861 $ cat > $TESTTMP/pausefinalize.py <<EOF
862 > from mercurial import extensions, localrepo
862 > from mercurial import extensions, localrepo
863 > import os, time
863 > import os, time
864 > def transaction(orig, self, desc, report=None):
864 > def transaction(orig, self, desc, report=None):
865 > tr = orig(self, desc, report)
865 > tr = orig(self, desc, report)
866 > def sleep(*args, **kwargs):
866 > def sleep(*args, **kwargs):
867 > retry = 20
867 > retry = 20
868 > while retry > 0 and not os.path.exists("$TESTTMP/unpause"):
868 > while retry > 0 and not os.path.exists("$TESTTMP/unpause"):
869 > retry -= 1
869 > retry -= 1
870 > time.sleep(0.5)
870 > time.sleep(0.5)
871 > if os.path.exists("$TESTTMP/unpause"):
871 > if os.path.exists("$TESTTMP/unpause"):
872 > os.remove("$TESTTMP/unpause")
872 > os.remove("$TESTTMP/unpause")
873 > # It is important that this finalizer start with 'a', so it runs before
873 > # It is important that this finalizer start with 'a', so it runs before
874 > # the changelog finalizer appends to the changelog.
874 > # the changelog finalizer appends to the changelog.
875 > tr.addfinalize('a-sleep', sleep)
875 > tr.addfinalize('a-sleep', sleep)
876 > return tr
876 > return tr
877 >
877 >
878 > def extsetup(ui):
878 > def extsetup(ui):
879 > # This extension inserts an artifical pause during the transaction
879 > # This extension inserts an artifical pause during the transaction
880 > # finalizer, so we can run commands mid-transaction-close.
880 > # finalizer, so we can run commands mid-transaction-close.
881 > extensions.wrapfunction(localrepo.localrepository, 'transaction',
881 > extensions.wrapfunction(localrepo.localrepository, 'transaction',
882 > transaction)
882 > transaction)
883 > EOF
883 > EOF
884 $ hg commit -qm two --config extensions.pausefinalize=$TESTTMP/pausefinalize.py &
884 $ hg commit -qm two --config extensions.pausefinalize=$TESTTMP/pausefinalize.py &
885 $ sleep 2
885 $ sleep 2
886 $ hg log -r .
886 $ hg log -r .
887 changeset: 0:867bc5792c8c
887 changeset: 0:867bc5792c8c
888 bookmark: mybook
888 bookmark: mybook
889 tag: tip
889 tag: tip
890 user: test
890 user: test
891 date: Thu Jan 01 00:00:00 1970 +0000
891 date: Thu Jan 01 00:00:00 1970 +0000
892 summary: one
892 summary: one
893
893
894 $ hg bookmarks
894 $ hg bookmarks
895 * mybook 0:867bc5792c8c
895 * mybook 0:867bc5792c8c
896 $ touch $TESTTMP/unpause
896 $ touch $TESTTMP/unpause
897
897
898 $ cd ..
898 $ cd ..
899
899
900 check whether HG_PENDING makes pending changes only in related
900 check whether HG_PENDING makes pending changes only in related
901 repositories visible to an external hook.
901 repositories visible to an external hook.
902
902
903 (emulate a transaction running concurrently by copied
903 (emulate a transaction running concurrently by copied
904 .hg/bookmarks.pending in subsequent test)
904 .hg/bookmarks.pending in subsequent test)
905
905
906 $ cat > $TESTTMP/savepending.sh <<EOF
906 $ cat > $TESTTMP/savepending.sh <<EOF
907 > cp .hg/bookmarks.pending .hg/bookmarks.pending.saved
907 > cp .hg/bookmarks.pending .hg/bookmarks.pending.saved
908 > exit 1 # to avoid adding new bookmark for subsequent tests
908 > exit 1 # to avoid adding new bookmark for subsequent tests
909 > EOF
909 > EOF
910
910
911 $ hg init unrelated
911 $ hg init unrelated
912 $ cd unrelated
912 $ cd unrelated
913 $ echo a > a
913 $ echo a > a
914 $ hg add a
914 $ hg add a
915 $ hg commit -m '#0'
915 $ hg commit -m '#0'
916 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" bookmarks INVISIBLE
916 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" bookmarks INVISIBLE
917 transaction abort!
917 transaction abort!
918 rollback completed
918 rollback completed
919 abort: pretxnclose hook exited with status 1
919 abort: pretxnclose hook exited with status 1
920 [255]
920 [255]
921 $ cp .hg/bookmarks.pending.saved .hg/bookmarks.pending
921 $ cp .hg/bookmarks.pending.saved .hg/bookmarks.pending
922
922
923 (check visible bookmarks while transaction running in repo)
923 (check visible bookmarks while transaction running in repo)
924
924
925 $ cat > $TESTTMP/checkpending.sh <<EOF
925 $ cat > $TESTTMP/checkpending.sh <<EOF
926 > echo "@repo"
926 > echo "@repo"
927 > hg -R $TESTTMP/repo bookmarks
927 > hg -R "$TESTTMP/repo" bookmarks
928 > echo "@unrelated"
928 > echo "@unrelated"
929 > hg -R $TESTTMP/unrelated bookmarks
929 > hg -R "$TESTTMP/unrelated" bookmarks
930 > exit 1 # to avoid adding new bookmark for subsequent tests
930 > exit 1 # to avoid adding new bookmark for subsequent tests
931 > EOF
931 > EOF
932
932
933 $ cd ../repo
933 $ cd ../repo
934 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" bookmarks NEW
934 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" bookmarks NEW
935 @repo
935 @repo
936 * NEW 6:81dcce76aa0b
936 * NEW 6:81dcce76aa0b
937 X2 1:925d80f479bb
937 X2 1:925d80f479bb
938 Y 4:125c9a1d6df6
938 Y 4:125c9a1d6df6
939 Z 5:5fb12f0f2d51
939 Z 5:5fb12f0f2d51
940 Z@1 1:925d80f479bb
940 Z@1 1:925d80f479bb
941 Z@2 4:125c9a1d6df6
941 Z@2 4:125c9a1d6df6
942 foo 3:9ba5f110a0b3
942 foo 3:9ba5f110a0b3
943 foo@1 0:f7b1eb17ad24
943 foo@1 0:f7b1eb17ad24
944 foo@2 2:db815d6d32e6
944 foo@2 2:db815d6d32e6
945 four 3:9ba5f110a0b3
945 four 3:9ba5f110a0b3
946 should-end-on-two 2:db815d6d32e6
946 should-end-on-two 2:db815d6d32e6
947 x y 2:db815d6d32e6
947 x y 2:db815d6d32e6
948 @unrelated
948 @unrelated
949 no bookmarks set
949 no bookmarks set
950 transaction abort!
950 transaction abort!
951 rollback completed
951 rollback completed
952 abort: pretxnclose hook exited with status 1
952 abort: pretxnclose hook exited with status 1
953 [255]
953 [255]
@@ -1,935 +1,935 b''
1 commit hooks can see env vars
1 commit hooks can see env vars
2 (and post-transaction one are run unlocked)
2 (and post-transaction one are run unlocked)
3
3
4
4
5 $ cat > $TESTTMP/txnabort.checkargs.py <<EOF
5 $ cat > $TESTTMP/txnabort.checkargs.py <<EOF
6 > def showargs(ui, repo, hooktype, **kwargs):
6 > def showargs(ui, repo, hooktype, **kwargs):
7 > ui.write('%s python hook: %s\n' % (hooktype, ','.join(sorted(kwargs))))
7 > ui.write('%s python hook: %s\n' % (hooktype, ','.join(sorted(kwargs))))
8 > EOF
8 > EOF
9
9
10 $ hg init a
10 $ hg init a
11 $ cd a
11 $ cd a
12 $ cat > .hg/hgrc <<EOF
12 $ cat > .hg/hgrc <<EOF
13 > [hooks]
13 > [hooks]
14 > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit"
14 > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit"
15 > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b"
15 > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b"
16 > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit"
16 > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit"
17 > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit"
17 > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit"
18 > pretxncommit.tip = hg -q tip
18 > pretxncommit.tip = hg -q tip
19 > pre-identify = sh -c "printenv.py pre-identify 1"
19 > pre-identify = sh -c "printenv.py pre-identify 1"
20 > pre-cat = sh -c "printenv.py pre-cat"
20 > pre-cat = sh -c "printenv.py pre-cat"
21 > post-cat = sh -c "printenv.py post-cat"
21 > post-cat = sh -c "printenv.py post-cat"
22 > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen"
22 > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen"
23 > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose"
23 > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose"
24 > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose"
24 > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose"
25 > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs
25 > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs
26 > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort"
26 > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort"
27 > txnclose.checklock = sh -c "hg debuglock > /dev/null"
27 > txnclose.checklock = sh -c "hg debuglock > /dev/null"
28 > EOF
28 > EOF
29 $ echo a > a
29 $ echo a > a
30 $ hg add a
30 $ hg add a
31 $ hg commit -m a
31 $ hg commit -m a
32 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=0000000000000000000000000000000000000000
32 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=0000000000000000000000000000000000000000
33 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
33 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
34 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
34 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
35 0:cb9a9f314b8b
35 0:cb9a9f314b8b
36 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
36 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
37 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
37 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
38 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
38 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
39 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
39 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
40
40
41 $ hg clone . ../b
41 $ hg clone . ../b
42 updating to branch default
42 updating to branch default
43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
44 $ cd ../b
44 $ cd ../b
45
45
46 changegroup hooks can see env vars
46 changegroup hooks can see env vars
47
47
48 $ cat > .hg/hgrc <<EOF
48 $ cat > .hg/hgrc <<EOF
49 > [hooks]
49 > [hooks]
50 > prechangegroup = sh -c "printenv.py prechangegroup"
50 > prechangegroup = sh -c "printenv.py prechangegroup"
51 > changegroup = sh -c "printenv.py changegroup"
51 > changegroup = sh -c "printenv.py changegroup"
52 > incoming = sh -c "printenv.py incoming"
52 > incoming = sh -c "printenv.py incoming"
53 > EOF
53 > EOF
54
54
55 pretxncommit and commit hooks can see both parents of merge
55 pretxncommit and commit hooks can see both parents of merge
56
56
57 $ cd ../a
57 $ cd ../a
58 $ echo b >> a
58 $ echo b >> a
59 $ hg commit -m a1 -d "1 0"
59 $ hg commit -m a1 -d "1 0"
60 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
60 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
61 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
61 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
62 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
62 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
63 1:ab228980c14d
63 1:ab228980c14d
64 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
64 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
65 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
65 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
66 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
66 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
67 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
67 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
68 $ hg update -C 0
68 $ hg update -C 0
69 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 $ echo b > b
70 $ echo b > b
71 $ hg add b
71 $ hg add b
72 $ hg commit -m b -d '1 0'
72 $ hg commit -m b -d '1 0'
73 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
73 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
74 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
74 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
75 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
75 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
76 2:ee9deb46ab31
76 2:ee9deb46ab31
77 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
77 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
78 created new head
78 created new head
79 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
79 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
80 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
80 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
81 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
81 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
82 $ hg merge 1
82 $ hg merge 1
83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 (branch merge, don't forget to commit)
84 (branch merge, don't forget to commit)
85 $ hg commit -m merge -d '2 0'
85 $ hg commit -m merge -d '2 0'
86 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
86 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
87 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
87 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
88 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a
88 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a
89 3:07f3376c1e65
89 3:07f3376c1e65
90 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
90 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
91 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
91 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
92 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
92 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
93 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
93 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
94
94
95 test generic hooks
95 test generic hooks
96
96
97 $ hg id
97 $ hg id
98 pre-identify hook: HG_ARGS=id HG_HOOKNAME=pre-identify HG_HOOKTYPE=pre-identify HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None} HG_PATS=[]
98 pre-identify hook: HG_ARGS=id HG_HOOKNAME=pre-identify HG_HOOKTYPE=pre-identify HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None} HG_PATS=[]
99 abort: pre-identify hook exited with status 1
99 abort: pre-identify hook exited with status 1
100 [255]
100 [255]
101 $ hg cat b
101 $ hg cat b
102 pre-cat hook: HG_ARGS=cat b HG_HOOKNAME=pre-cat HG_HOOKTYPE=pre-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b']
102 pre-cat hook: HG_ARGS=cat b HG_HOOKNAME=pre-cat HG_HOOKTYPE=pre-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b']
103 b
103 b
104 post-cat hook: HG_ARGS=cat b HG_HOOKNAME=post-cat HG_HOOKTYPE=post-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b'] HG_RESULT=0
104 post-cat hook: HG_ARGS=cat b HG_HOOKNAME=post-cat HG_HOOKTYPE=post-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b'] HG_RESULT=0
105
105
106 $ cd ../b
106 $ cd ../b
107 $ hg pull ../a
107 $ hg pull ../a
108 pulling from ../a
108 pulling from ../a
109 searching for changes
109 searching for changes
110 prechangegroup hook: HG_HOOKNAME=prechangegroup HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
110 prechangegroup hook: HG_HOOKNAME=prechangegroup HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
111 adding changesets
111 adding changesets
112 adding manifests
112 adding manifests
113 adding file changes
113 adding file changes
114 added 3 changesets with 2 changes to 2 files
114 added 3 changesets with 2 changes to 2 files
115 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
115 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
116 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
116 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
117 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
117 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
118 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
118 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
119 (run 'hg update' to get a working copy)
119 (run 'hg update' to get a working copy)
120
120
121 tag hooks can see env vars
121 tag hooks can see env vars
122
122
123 $ cd ../a
123 $ cd ../a
124 $ cat >> .hg/hgrc <<EOF
124 $ cat >> .hg/hgrc <<EOF
125 > pretag = sh -c "printenv.py pretag"
125 > pretag = sh -c "printenv.py pretag"
126 > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag"
126 > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag"
127 > EOF
127 > EOF
128 $ hg tag -d '3 0' a
128 $ hg tag -d '3 0' a
129 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
129 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
130 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
130 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
131 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
131 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
132 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a
132 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a
133 4:539e4b31b6dc
133 4:539e4b31b6dc
134 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
134 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
135 tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
135 tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
136 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
136 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
137 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
137 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
138 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
138 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
139 $ hg tag -l la
139 $ hg tag -l la
140 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
140 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
141 tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
141 tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
142
142
143 pretag hook can forbid tagging
143 pretag hook can forbid tagging
144
144
145 $ cat >> .hg/hgrc <<EOF
145 $ cat >> .hg/hgrc <<EOF
146 > pretag.forbid = sh -c "printenv.py pretag.forbid 1"
146 > pretag.forbid = sh -c "printenv.py pretag.forbid 1"
147 > EOF
147 > EOF
148 $ hg tag -d '4 0' fa
148 $ hg tag -d '4 0' fa
149 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
149 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
150 pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
150 pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
151 abort: pretag.forbid hook exited with status 1
151 abort: pretag.forbid hook exited with status 1
152 [255]
152 [255]
153 $ hg tag -l fla
153 $ hg tag -l fla
154 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
154 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
155 pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
155 pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
156 abort: pretag.forbid hook exited with status 1
156 abort: pretag.forbid hook exited with status 1
157 [255]
157 [255]
158
158
159 pretxncommit hook can see changeset, can roll back txn, changeset no
159 pretxncommit hook can see changeset, can roll back txn, changeset no
160 more there after
160 more there after
161
161
162 $ cat >> .hg/hgrc <<EOF
162 $ cat >> .hg/hgrc <<EOF
163 > pretxncommit.forbid0 = sh -c "hg tip -q"
163 > pretxncommit.forbid0 = sh -c "hg tip -q"
164 > pretxncommit.forbid1 = sh -c "printenv.py pretxncommit.forbid 1"
164 > pretxncommit.forbid1 = sh -c "printenv.py pretxncommit.forbid 1"
165 > EOF
165 > EOF
166 $ echo z > z
166 $ echo z > z
167 $ hg add z
167 $ hg add z
168 $ hg -q tip
168 $ hg -q tip
169 4:539e4b31b6dc
169 4:539e4b31b6dc
170 $ hg commit -m 'fail' -d '4 0'
170 $ hg commit -m 'fail' -d '4 0'
171 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
171 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
172 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
172 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
173 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
173 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
174 5:6f611f8018c1
174 5:6f611f8018c1
175 5:6f611f8018c1
175 5:6f611f8018c1
176 pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1 HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
176 pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1 HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
177 transaction abort!
177 transaction abort!
178 txnabort python hook: txnid,txnname
178 txnabort python hook: txnid,txnname
179 txnabort hook: HG_HOOKNAME=txnabort.1 HG_HOOKTYPE=txnabort HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
179 txnabort hook: HG_HOOKNAME=txnabort.1 HG_HOOKTYPE=txnabort HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
180 rollback completed
180 rollback completed
181 abort: pretxncommit.forbid1 hook exited with status 1
181 abort: pretxncommit.forbid1 hook exited with status 1
182 [255]
182 [255]
183 $ hg -q tip
183 $ hg -q tip
184 4:539e4b31b6dc
184 4:539e4b31b6dc
185
185
186 (Check that no 'changelog.i.a' file were left behind)
186 (Check that no 'changelog.i.a' file were left behind)
187
187
188 $ ls -1 .hg/store/
188 $ ls -1 .hg/store/
189 00changelog.i
189 00changelog.i
190 00manifest.i
190 00manifest.i
191 data
191 data
192 fncache
192 fncache
193 journal.phaseroots
193 journal.phaseroots
194 phaseroots
194 phaseroots
195 undo
195 undo
196 undo.backup.fncache
196 undo.backup.fncache
197 undo.backupfiles
197 undo.backupfiles
198 undo.phaseroots
198 undo.phaseroots
199
199
200
200
201 precommit hook can prevent commit
201 precommit hook can prevent commit
202
202
203 $ cat >> .hg/hgrc <<EOF
203 $ cat >> .hg/hgrc <<EOF
204 > precommit.forbid = sh -c "printenv.py precommit.forbid 1"
204 > precommit.forbid = sh -c "printenv.py precommit.forbid 1"
205 > EOF
205 > EOF
206 $ hg commit -m 'fail' -d '4 0'
206 $ hg commit -m 'fail' -d '4 0'
207 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
207 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
208 precommit.forbid hook: HG_HOOKNAME=precommit.forbid HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
208 precommit.forbid hook: HG_HOOKNAME=precommit.forbid HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
209 abort: precommit.forbid hook exited with status 1
209 abort: precommit.forbid hook exited with status 1
210 [255]
210 [255]
211 $ hg -q tip
211 $ hg -q tip
212 4:539e4b31b6dc
212 4:539e4b31b6dc
213
213
214 preupdate hook can prevent update
214 preupdate hook can prevent update
215
215
216 $ cat >> .hg/hgrc <<EOF
216 $ cat >> .hg/hgrc <<EOF
217 > preupdate = sh -c "printenv.py preupdate"
217 > preupdate = sh -c "printenv.py preupdate"
218 > EOF
218 > EOF
219 $ hg update 1
219 $ hg update 1
220 preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=ab228980c14d
220 preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=ab228980c14d
221 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
221 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
222
222
223 update hook
223 update hook
224
224
225 $ cat >> .hg/hgrc <<EOF
225 $ cat >> .hg/hgrc <<EOF
226 > update = sh -c "printenv.py update"
226 > update = sh -c "printenv.py update"
227 > EOF
227 > EOF
228 $ hg update
228 $ hg update
229 preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=539e4b31b6dc
229 preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=539e4b31b6dc
230 update hook: HG_ERROR=0 HG_HOOKNAME=update HG_HOOKTYPE=update HG_PARENT1=539e4b31b6dc
230 update hook: HG_ERROR=0 HG_HOOKNAME=update HG_HOOKTYPE=update HG_PARENT1=539e4b31b6dc
231 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
231 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
232
232
233 pushkey hook
233 pushkey hook
234
234
235 $ cat >> .hg/hgrc <<EOF
235 $ cat >> .hg/hgrc <<EOF
236 > pushkey = sh -c "printenv.py pushkey"
236 > pushkey = sh -c "printenv.py pushkey"
237 > EOF
237 > EOF
238 $ cd ../b
238 $ cd ../b
239 $ hg bookmark -r null foo
239 $ hg bookmark -r null foo
240 $ hg push -B foo ../a
240 $ hg push -B foo ../a
241 pushing to ../a
241 pushing to ../a
242 searching for changes
242 searching for changes
243 no changes found
243 no changes found
244 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
244 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
245 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
245 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
246 pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
246 pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
247 txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
247 txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
248 exporting bookmark foo
248 exporting bookmark foo
249 [1]
249 [1]
250 $ cd ../a
250 $ cd ../a
251
251
252 listkeys hook
252 listkeys hook
253
253
254 $ cat >> .hg/hgrc <<EOF
254 $ cat >> .hg/hgrc <<EOF
255 > listkeys = sh -c "printenv.py listkeys"
255 > listkeys = sh -c "printenv.py listkeys"
256 > EOF
256 > EOF
257 $ hg bookmark -r null bar
257 $ hg bookmark -r null bar
258 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
258 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
259 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
259 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
260 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
260 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
261 $ cd ../b
261 $ cd ../b
262 $ hg pull -B bar ../a
262 $ hg pull -B bar ../a
263 pulling from ../a
263 pulling from ../a
264 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
264 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
265 no changes found
265 no changes found
266 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
266 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
267 adding remote bookmark bar
267 adding remote bookmark bar
268 $ cd ../a
268 $ cd ../a
269
269
270 test that prepushkey can prevent incoming keys
270 test that prepushkey can prevent incoming keys
271
271
272 $ cat >> .hg/hgrc <<EOF
272 $ cat >> .hg/hgrc <<EOF
273 > prepushkey = sh -c "printenv.py prepushkey.forbid 1"
273 > prepushkey = sh -c "printenv.py prepushkey.forbid 1"
274 > EOF
274 > EOF
275 $ cd ../b
275 $ cd ../b
276 $ hg bookmark -r null baz
276 $ hg bookmark -r null baz
277 $ hg push -B baz ../a
277 $ hg push -B baz ../a
278 pushing to ../a
278 pushing to ../a
279 searching for changes
279 searching for changes
280 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
280 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
281 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
281 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
282 no changes found
282 no changes found
283 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
283 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
284 prepushkey.forbid hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
284 prepushkey.forbid hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
285 pushkey-abort: prepushkey hook exited with status 1
285 pushkey-abort: prepushkey hook exited with status 1
286 abort: exporting bookmark baz failed!
286 abort: exporting bookmark baz failed!
287 [255]
287 [255]
288 $ cd ../a
288 $ cd ../a
289
289
290 test that prelistkeys can prevent listing keys
290 test that prelistkeys can prevent listing keys
291
291
292 $ cat >> .hg/hgrc <<EOF
292 $ cat >> .hg/hgrc <<EOF
293 > prelistkeys = sh -c "printenv.py prelistkeys.forbid 1"
293 > prelistkeys = sh -c "printenv.py prelistkeys.forbid 1"
294 > EOF
294 > EOF
295 $ hg bookmark -r null quux
295 $ hg bookmark -r null quux
296 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
296 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
297 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
297 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
298 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
298 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
299 $ cd ../b
299 $ cd ../b
300 $ hg pull -B quux ../a
300 $ hg pull -B quux ../a
301 pulling from ../a
301 pulling from ../a
302 prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys HG_HOOKTYPE=prelistkeys HG_NAMESPACE=bookmarks
302 prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys HG_HOOKTYPE=prelistkeys HG_NAMESPACE=bookmarks
303 abort: prelistkeys hook exited with status 1
303 abort: prelistkeys hook exited with status 1
304 [255]
304 [255]
305 $ cd ../a
305 $ cd ../a
306 $ rm .hg/hgrc
306 $ rm .hg/hgrc
307
307
308 prechangegroup hook can prevent incoming changes
308 prechangegroup hook can prevent incoming changes
309
309
310 $ cd ../b
310 $ cd ../b
311 $ hg -q tip
311 $ hg -q tip
312 3:07f3376c1e65
312 3:07f3376c1e65
313 $ cat > .hg/hgrc <<EOF
313 $ cat > .hg/hgrc <<EOF
314 > [hooks]
314 > [hooks]
315 > prechangegroup.forbid = sh -c "printenv.py prechangegroup.forbid 1"
315 > prechangegroup.forbid = sh -c "printenv.py prechangegroup.forbid 1"
316 > EOF
316 > EOF
317 $ hg pull ../a
317 $ hg pull ../a
318 pulling from ../a
318 pulling from ../a
319 searching for changes
319 searching for changes
320 prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
320 prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
321 abort: prechangegroup.forbid hook exited with status 1
321 abort: prechangegroup.forbid hook exited with status 1
322 [255]
322 [255]
323
323
324 pretxnchangegroup hook can see incoming changes, can roll back txn,
324 pretxnchangegroup hook can see incoming changes, can roll back txn,
325 incoming changes no longer there after
325 incoming changes no longer there after
326
326
327 $ cat > .hg/hgrc <<EOF
327 $ cat > .hg/hgrc <<EOF
328 > [hooks]
328 > [hooks]
329 > pretxnchangegroup.forbid0 = hg tip -q
329 > pretxnchangegroup.forbid0 = hg tip -q
330 > pretxnchangegroup.forbid1 = sh -c "printenv.py pretxnchangegroup.forbid 1"
330 > pretxnchangegroup.forbid1 = sh -c "printenv.py pretxnchangegroup.forbid 1"
331 > EOF
331 > EOF
332 $ hg pull ../a
332 $ hg pull ../a
333 pulling from ../a
333 pulling from ../a
334 searching for changes
334 searching for changes
335 adding changesets
335 adding changesets
336 adding manifests
336 adding manifests
337 adding file changes
337 adding file changes
338 added 1 changesets with 1 changes to 1 files
338 added 1 changesets with 1 changes to 1 files
339 4:539e4b31b6dc
339 4:539e4b31b6dc
340 pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1 HG_HOOKTYPE=pretxnchangegroup HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
340 pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1 HG_HOOKTYPE=pretxnchangegroup HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
341 transaction abort!
341 transaction abort!
342 rollback completed
342 rollback completed
343 abort: pretxnchangegroup.forbid1 hook exited with status 1
343 abort: pretxnchangegroup.forbid1 hook exited with status 1
344 [255]
344 [255]
345 $ hg -q tip
345 $ hg -q tip
346 3:07f3376c1e65
346 3:07f3376c1e65
347
347
348 outgoing hooks can see env vars
348 outgoing hooks can see env vars
349
349
350 $ rm .hg/hgrc
350 $ rm .hg/hgrc
351 $ cat > ../a/.hg/hgrc <<EOF
351 $ cat > ../a/.hg/hgrc <<EOF
352 > [hooks]
352 > [hooks]
353 > preoutgoing = sh -c "printenv.py preoutgoing"
353 > preoutgoing = sh -c "printenv.py preoutgoing"
354 > outgoing = sh -c "printenv.py outgoing"
354 > outgoing = sh -c "printenv.py outgoing"
355 > EOF
355 > EOF
356 $ hg pull ../a
356 $ hg pull ../a
357 pulling from ../a
357 pulling from ../a
358 searching for changes
358 searching for changes
359 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
359 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
360 outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
360 outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
361 adding changesets
361 adding changesets
362 adding manifests
362 adding manifests
363 adding file changes
363 adding file changes
364 added 1 changesets with 1 changes to 1 files
364 added 1 changesets with 1 changes to 1 files
365 adding remote bookmark quux
365 adding remote bookmark quux
366 (run 'hg update' to get a working copy)
366 (run 'hg update' to get a working copy)
367 $ hg rollback
367 $ hg rollback
368 repository tip rolled back to revision 3 (undo pull)
368 repository tip rolled back to revision 3 (undo pull)
369
369
370 preoutgoing hook can prevent outgoing changes
370 preoutgoing hook can prevent outgoing changes
371
371
372 $ cat >> ../a/.hg/hgrc <<EOF
372 $ cat >> ../a/.hg/hgrc <<EOF
373 > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1"
373 > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1"
374 > EOF
374 > EOF
375 $ hg pull ../a
375 $ hg pull ../a
376 pulling from ../a
376 pulling from ../a
377 searching for changes
377 searching for changes
378 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
378 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
379 preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
379 preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
380 abort: preoutgoing.forbid hook exited with status 1
380 abort: preoutgoing.forbid hook exited with status 1
381 [255]
381 [255]
382
382
383 outgoing hooks work for local clones
383 outgoing hooks work for local clones
384
384
385 $ cd ..
385 $ cd ..
386 $ cat > a/.hg/hgrc <<EOF
386 $ cat > a/.hg/hgrc <<EOF
387 > [hooks]
387 > [hooks]
388 > preoutgoing = sh -c "printenv.py preoutgoing"
388 > preoutgoing = sh -c "printenv.py preoutgoing"
389 > outgoing = sh -c "printenv.py outgoing"
389 > outgoing = sh -c "printenv.py outgoing"
390 > EOF
390 > EOF
391 $ hg clone a c
391 $ hg clone a c
392 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
392 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
393 outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone
393 outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone
394 updating to branch default
394 updating to branch default
395 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
395 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
396 $ rm -rf c
396 $ rm -rf c
397
397
398 preoutgoing hook can prevent outgoing changes for local clones
398 preoutgoing hook can prevent outgoing changes for local clones
399
399
400 $ cat >> a/.hg/hgrc <<EOF
400 $ cat >> a/.hg/hgrc <<EOF
401 > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1"
401 > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1"
402 > EOF
402 > EOF
403 $ hg clone a zzz
403 $ hg clone a zzz
404 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
404 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
405 preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
405 preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
406 abort: preoutgoing.forbid hook exited with status 1
406 abort: preoutgoing.forbid hook exited with status 1
407 [255]
407 [255]
408
408
409 $ cd "$TESTTMP/b"
409 $ cd "$TESTTMP/b"
410
410
411 $ cat > hooktests.py <<EOF
411 $ cat > hooktests.py <<EOF
412 > from mercurial import error
412 > from mercurial import error
413 >
413 >
414 > uncallable = 0
414 > uncallable = 0
415 >
415 >
416 > def printargs(args):
416 > def printargs(args):
417 > args.pop('ui', None)
417 > args.pop('ui', None)
418 > args.pop('repo', None)
418 > args.pop('repo', None)
419 > a = list(args.items())
419 > a = list(args.items())
420 > a.sort()
420 > a.sort()
421 > print 'hook args:'
421 > print 'hook args:'
422 > for k, v in a:
422 > for k, v in a:
423 > print ' ', k, v
423 > print ' ', k, v
424 >
424 >
425 > def passhook(**args):
425 > def passhook(**args):
426 > printargs(args)
426 > printargs(args)
427 >
427 >
428 > def failhook(**args):
428 > def failhook(**args):
429 > printargs(args)
429 > printargs(args)
430 > return True
430 > return True
431 >
431 >
432 > class LocalException(Exception):
432 > class LocalException(Exception):
433 > pass
433 > pass
434 >
434 >
435 > def raisehook(**args):
435 > def raisehook(**args):
436 > raise LocalException('exception from hook')
436 > raise LocalException('exception from hook')
437 >
437 >
438 > def aborthook(**args):
438 > def aborthook(**args):
439 > raise error.Abort('raise abort from hook')
439 > raise error.Abort('raise abort from hook')
440 >
440 >
441 > def brokenhook(**args):
441 > def brokenhook(**args):
442 > return 1 + {}
442 > return 1 + {}
443 >
443 >
444 > def verbosehook(ui, **args):
444 > def verbosehook(ui, **args):
445 > ui.note('verbose output from hook\n')
445 > ui.note('verbose output from hook\n')
446 >
446 >
447 > def printtags(ui, repo, **args):
447 > def printtags(ui, repo, **args):
448 > print sorted(repo.tags())
448 > print sorted(repo.tags())
449 >
449 >
450 > class container:
450 > class container:
451 > unreachable = 1
451 > unreachable = 1
452 > EOF
452 > EOF
453
453
454 $ cat > syntaxerror.py << EOF
454 $ cat > syntaxerror.py << EOF
455 > (foo
455 > (foo
456 > EOF
456 > EOF
457
457
458 test python hooks
458 test python hooks
459
459
460 #if windows
460 #if windows
461 $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH"
461 $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH"
462 #else
462 #else
463 $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH"
463 $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH"
464 #endif
464 #endif
465 $ export PYTHONPATH
465 $ export PYTHONPATH
466
466
467 $ echo '[hooks]' > ../a/.hg/hgrc
467 $ echo '[hooks]' > ../a/.hg/hgrc
468 $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc
468 $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc
469 $ hg pull ../a 2>&1 | grep 'raised an exception'
469 $ hg pull ../a 2>&1 | grep 'raised an exception'
470 error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
470 error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
471
471
472 $ echo '[hooks]' > ../a/.hg/hgrc
472 $ echo '[hooks]' > ../a/.hg/hgrc
473 $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc
473 $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc
474 $ hg pull ../a 2>&1 | grep 'raised an exception'
474 $ hg pull ../a 2>&1 | grep 'raised an exception'
475 error: preoutgoing.raise hook raised an exception: exception from hook
475 error: preoutgoing.raise hook raised an exception: exception from hook
476
476
477 $ echo '[hooks]' > ../a/.hg/hgrc
477 $ echo '[hooks]' > ../a/.hg/hgrc
478 $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc
478 $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc
479 $ hg pull ../a
479 $ hg pull ../a
480 pulling from ../a
480 pulling from ../a
481 searching for changes
481 searching for changes
482 error: preoutgoing.abort hook failed: raise abort from hook
482 error: preoutgoing.abort hook failed: raise abort from hook
483 abort: raise abort from hook
483 abort: raise abort from hook
484 [255]
484 [255]
485
485
486 $ echo '[hooks]' > ../a/.hg/hgrc
486 $ echo '[hooks]' > ../a/.hg/hgrc
487 $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc
487 $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc
488 $ hg pull ../a
488 $ hg pull ../a
489 pulling from ../a
489 pulling from ../a
490 searching for changes
490 searching for changes
491 hook args:
491 hook args:
492 hooktype preoutgoing
492 hooktype preoutgoing
493 source pull
493 source pull
494 abort: preoutgoing.fail hook failed
494 abort: preoutgoing.fail hook failed
495 [255]
495 [255]
496
496
497 $ echo '[hooks]' > ../a/.hg/hgrc
497 $ echo '[hooks]' > ../a/.hg/hgrc
498 $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc
498 $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc
499 $ hg pull ../a
499 $ hg pull ../a
500 pulling from ../a
500 pulling from ../a
501 searching for changes
501 searching for changes
502 abort: preoutgoing.uncallable hook is invalid: "hooktests.uncallable" is not callable
502 abort: preoutgoing.uncallable hook is invalid: "hooktests.uncallable" is not callable
503 [255]
503 [255]
504
504
505 $ echo '[hooks]' > ../a/.hg/hgrc
505 $ echo '[hooks]' > ../a/.hg/hgrc
506 $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc
506 $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc
507 $ hg pull ../a
507 $ hg pull ../a
508 pulling from ../a
508 pulling from ../a
509 searching for changes
509 searching for changes
510 abort: preoutgoing.nohook hook is invalid: "hooktests.nohook" is not defined
510 abort: preoutgoing.nohook hook is invalid: "hooktests.nohook" is not defined
511 [255]
511 [255]
512
512
513 $ echo '[hooks]' > ../a/.hg/hgrc
513 $ echo '[hooks]' > ../a/.hg/hgrc
514 $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc
514 $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc
515 $ hg pull ../a
515 $ hg pull ../a
516 pulling from ../a
516 pulling from ../a
517 searching for changes
517 searching for changes
518 abort: preoutgoing.nomodule hook is invalid: "nomodule" not in a module
518 abort: preoutgoing.nomodule hook is invalid: "nomodule" not in a module
519 [255]
519 [255]
520
520
521 $ echo '[hooks]' > ../a/.hg/hgrc
521 $ echo '[hooks]' > ../a/.hg/hgrc
522 $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc
522 $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc
523 $ hg pull ../a
523 $ hg pull ../a
524 pulling from ../a
524 pulling from ../a
525 searching for changes
525 searching for changes
526 abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed
526 abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed
527 (run with --traceback for stack trace)
527 (run with --traceback for stack trace)
528 [255]
528 [255]
529
529
530 $ echo '[hooks]' > ../a/.hg/hgrc
530 $ echo '[hooks]' > ../a/.hg/hgrc
531 $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc
531 $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc
532 $ hg pull ../a
532 $ hg pull ../a
533 pulling from ../a
533 pulling from ../a
534 searching for changes
534 searching for changes
535 abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed
535 abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed
536 (run with --traceback for stack trace)
536 (run with --traceback for stack trace)
537 [255]
537 [255]
538
538
539 $ echo '[hooks]' > ../a/.hg/hgrc
539 $ echo '[hooks]' > ../a/.hg/hgrc
540 $ echo 'preoutgoing.syntaxerror = python:syntaxerror.syntaxerror' >> ../a/.hg/hgrc
540 $ echo 'preoutgoing.syntaxerror = python:syntaxerror.syntaxerror' >> ../a/.hg/hgrc
541 $ hg pull ../a
541 $ hg pull ../a
542 pulling from ../a
542 pulling from ../a
543 searching for changes
543 searching for changes
544 abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
544 abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
545 (run with --traceback for stack trace)
545 (run with --traceback for stack trace)
546 [255]
546 [255]
547
547
548 The second egrep is to filter out lines like ' ^', which are slightly
548 The second egrep is to filter out lines like ' ^', which are slightly
549 different between Python 2.6 and Python 2.7.
549 different between Python 2.6 and Python 2.7.
550 $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File| [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$'
550 $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File| [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$'
551 pulling from ../a
551 pulling from ../a
552 searching for changes
552 searching for changes
553 exception from first failed import attempt:
553 exception from first failed import attempt:
554 Traceback (most recent call last):
554 Traceback (most recent call last):
555 SyntaxError: * (glob)
555 SyntaxError: * (glob)
556 exception from second failed import attempt:
556 exception from second failed import attempt:
557 Traceback (most recent call last):
557 Traceback (most recent call last):
558 ImportError: No module named hgext_syntaxerror
558 ImportError: No module named hgext_syntaxerror
559 Traceback (most recent call last):
559 Traceback (most recent call last):
560 HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
560 HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
561 abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
561 abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
562
562
563 $ echo '[hooks]' > ../a/.hg/hgrc
563 $ echo '[hooks]' > ../a/.hg/hgrc
564 $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc
564 $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc
565 $ hg pull ../a
565 $ hg pull ../a
566 pulling from ../a
566 pulling from ../a
567 searching for changes
567 searching for changes
568 hook args:
568 hook args:
569 hooktype preoutgoing
569 hooktype preoutgoing
570 source pull
570 source pull
571 adding changesets
571 adding changesets
572 adding manifests
572 adding manifests
573 adding file changes
573 adding file changes
574 added 1 changesets with 1 changes to 1 files
574 added 1 changesets with 1 changes to 1 files
575 adding remote bookmark quux
575 adding remote bookmark quux
576 (run 'hg update' to get a working copy)
576 (run 'hg update' to get a working copy)
577
577
578 post- python hooks that fail to *run* don't cause an abort
578 post- python hooks that fail to *run* don't cause an abort
579 $ rm ../a/.hg/hgrc
579 $ rm ../a/.hg/hgrc
580 $ echo '[hooks]' > .hg/hgrc
580 $ echo '[hooks]' > .hg/hgrc
581 $ echo 'post-pull.broken = python:hooktests.brokenhook' >> .hg/hgrc
581 $ echo 'post-pull.broken = python:hooktests.brokenhook' >> .hg/hgrc
582 $ hg pull ../a
582 $ hg pull ../a
583 pulling from ../a
583 pulling from ../a
584 searching for changes
584 searching for changes
585 no changes found
585 no changes found
586 error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
586 error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
587 (run with --traceback for stack trace)
587 (run with --traceback for stack trace)
588
588
589 but post- python hooks that fail to *load* do
589 but post- python hooks that fail to *load* do
590 $ echo '[hooks]' > .hg/hgrc
590 $ echo '[hooks]' > .hg/hgrc
591 $ echo 'post-pull.nomodule = python:nomodule' >> .hg/hgrc
591 $ echo 'post-pull.nomodule = python:nomodule' >> .hg/hgrc
592 $ hg pull ../a
592 $ hg pull ../a
593 pulling from ../a
593 pulling from ../a
594 searching for changes
594 searching for changes
595 no changes found
595 no changes found
596 abort: post-pull.nomodule hook is invalid: "nomodule" not in a module
596 abort: post-pull.nomodule hook is invalid: "nomodule" not in a module
597 [255]
597 [255]
598
598
599 $ echo '[hooks]' > .hg/hgrc
599 $ echo '[hooks]' > .hg/hgrc
600 $ echo 'post-pull.badmodule = python:nomodule.nowhere' >> .hg/hgrc
600 $ echo 'post-pull.badmodule = python:nomodule.nowhere' >> .hg/hgrc
601 $ hg pull ../a
601 $ hg pull ../a
602 pulling from ../a
602 pulling from ../a
603 searching for changes
603 searching for changes
604 no changes found
604 no changes found
605 abort: post-pull.badmodule hook is invalid: import of "nomodule" failed
605 abort: post-pull.badmodule hook is invalid: import of "nomodule" failed
606 (run with --traceback for stack trace)
606 (run with --traceback for stack trace)
607 [255]
607 [255]
608
608
609 $ echo '[hooks]' > .hg/hgrc
609 $ echo '[hooks]' > .hg/hgrc
610 $ echo 'post-pull.nohook = python:hooktests.nohook' >> .hg/hgrc
610 $ echo 'post-pull.nohook = python:hooktests.nohook' >> .hg/hgrc
611 $ hg pull ../a
611 $ hg pull ../a
612 pulling from ../a
612 pulling from ../a
613 searching for changes
613 searching for changes
614 no changes found
614 no changes found
615 abort: post-pull.nohook hook is invalid: "hooktests.nohook" is not defined
615 abort: post-pull.nohook hook is invalid: "hooktests.nohook" is not defined
616 [255]
616 [255]
617
617
618 make sure --traceback works
618 make sure --traceback works
619
619
620 $ echo '[hooks]' > .hg/hgrc
620 $ echo '[hooks]' > .hg/hgrc
621 $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc
621 $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc
622
622
623 $ echo aa > a
623 $ echo aa > a
624 $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback'
624 $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback'
625 Traceback (most recent call last):
625 Traceback (most recent call last):
626
626
627 $ cd ..
627 $ cd ..
628 $ hg init c
628 $ hg init c
629 $ cd c
629 $ cd c
630
630
631 $ cat > hookext.py <<EOF
631 $ cat > hookext.py <<EOF
632 > def autohook(**args):
632 > def autohook(**args):
633 > print "Automatically installed hook"
633 > print "Automatically installed hook"
634 >
634 >
635 > def reposetup(ui, repo):
635 > def reposetup(ui, repo):
636 > repo.ui.setconfig("hooks", "commit.auto", autohook)
636 > repo.ui.setconfig("hooks", "commit.auto", autohook)
637 > EOF
637 > EOF
638 $ echo '[extensions]' >> .hg/hgrc
638 $ echo '[extensions]' >> .hg/hgrc
639 $ echo 'hookext = hookext.py' >> .hg/hgrc
639 $ echo 'hookext = hookext.py' >> .hg/hgrc
640
640
641 $ touch foo
641 $ touch foo
642 $ hg add foo
642 $ hg add foo
643 $ hg ci -d '0 0' -m 'add foo'
643 $ hg ci -d '0 0' -m 'add foo'
644 Automatically installed hook
644 Automatically installed hook
645 $ echo >> foo
645 $ echo >> foo
646 $ hg ci --debug -d '0 0' -m 'change foo'
646 $ hg ci --debug -d '0 0' -m 'change foo'
647 committing files:
647 committing files:
648 foo
648 foo
649 committing manifest
649 committing manifest
650 committing changelog
650 committing changelog
651 committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708
651 committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708
652 calling hook commit.auto: hgext_hookext.autohook
652 calling hook commit.auto: hgext_hookext.autohook
653 Automatically installed hook
653 Automatically installed hook
654
654
655 $ hg showconfig hooks
655 $ hg showconfig hooks
656 hooks.commit.auto=<function autohook at *> (glob)
656 hooks.commit.auto=<function autohook at *> (glob)
657
657
658 test python hook configured with python:[file]:[hook] syntax
658 test python hook configured with python:[file]:[hook] syntax
659
659
660 $ cd ..
660 $ cd ..
661 $ mkdir d
661 $ mkdir d
662 $ cd d
662 $ cd d
663 $ hg init repo
663 $ hg init repo
664 $ mkdir hooks
664 $ mkdir hooks
665
665
666 $ cd hooks
666 $ cd hooks
667 $ cat > testhooks.py <<EOF
667 $ cat > testhooks.py <<EOF
668 > def testhook(**args):
668 > def testhook(**args):
669 > print 'hook works'
669 > print 'hook works'
670 > EOF
670 > EOF
671 $ echo '[hooks]' > ../repo/.hg/hgrc
671 $ echo '[hooks]' > ../repo/.hg/hgrc
672 $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc
672 $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc
673
673
674 $ cd ../repo
674 $ cd ../repo
675 $ hg commit -d '0 0'
675 $ hg commit -d '0 0'
676 hook works
676 hook works
677 nothing changed
677 nothing changed
678 [1]
678 [1]
679
679
680 $ echo '[hooks]' > .hg/hgrc
680 $ echo '[hooks]' > .hg/hgrc
681 $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc
681 $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc
682 $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc
682 $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc
683
683
684 $ hg up null
684 $ hg up null
685 loading update.ne hook failed:
685 loading update.ne hook failed:
686 abort: No such file or directory: $TESTTMP/d/repo/nonexistent.py
686 abort: No such file or directory: $TESTTMP/d/repo/nonexistent.py
687 [255]
687 [255]
688
688
689 $ hg id
689 $ hg id
690 loading pre-identify.npmd hook failed:
690 loading pre-identify.npmd hook failed:
691 abort: No module named repo!
691 abort: No module named repo!
692 [255]
692 [255]
693
693
694 $ cd ../../b
694 $ cd ../../b
695
695
696 make sure --traceback works on hook import failure
696 make sure --traceback works on hook import failure
697
697
698 $ cat > importfail.py <<EOF
698 $ cat > importfail.py <<EOF
699 > import somebogusmodule
699 > import somebogusmodule
700 > # dereference something in the module to force demandimport to load it
700 > # dereference something in the module to force demandimport to load it
701 > somebogusmodule.whatever
701 > somebogusmodule.whatever
702 > EOF
702 > EOF
703
703
704 $ echo '[hooks]' > .hg/hgrc
704 $ echo '[hooks]' > .hg/hgrc
705 $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc
705 $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc
706
706
707 $ echo a >> a
707 $ echo a >> a
708 $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])'
708 $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])'
709 exception from first failed import attempt:
709 exception from first failed import attempt:
710 Traceback (most recent call last):
710 Traceback (most recent call last):
711 ImportError: No module named somebogusmodule
711 ImportError: No module named somebogusmodule
712 exception from second failed import attempt:
712 exception from second failed import attempt:
713 Traceback (most recent call last):
713 Traceback (most recent call last):
714 ImportError: No module named hgext_importfail
714 ImportError: No module named hgext_importfail
715 Traceback (most recent call last):
715 Traceback (most recent call last):
716 HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed
716 HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed
717 abort: precommit.importfail hook is invalid: import of "importfail" failed
717 abort: precommit.importfail hook is invalid: import of "importfail" failed
718
718
719 Issue1827: Hooks Update & Commit not completely post operation
719 Issue1827: Hooks Update & Commit not completely post operation
720
720
721 commit and update hooks should run after command completion. The largefiles
721 commit and update hooks should run after command completion. The largefiles
722 use demonstrates a recursive wlock, showing the hook doesn't run until the
722 use demonstrates a recursive wlock, showing the hook doesn't run until the
723 final release (and dirstate flush).
723 final release (and dirstate flush).
724
724
725 $ echo '[hooks]' > .hg/hgrc
725 $ echo '[hooks]' > .hg/hgrc
726 $ echo 'commit = hg id' >> .hg/hgrc
726 $ echo 'commit = hg id' >> .hg/hgrc
727 $ echo 'update = hg id' >> .hg/hgrc
727 $ echo 'update = hg id' >> .hg/hgrc
728 $ echo bb > a
728 $ echo bb > a
729 $ hg ci -ma
729 $ hg ci -ma
730 223eafe2750c tip
730 223eafe2750c tip
731 $ hg up 0 --config extensions.largefiles=
731 $ hg up 0 --config extensions.largefiles=
732 cb9a9f314b8b
732 cb9a9f314b8b
733 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
733 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
734
734
735 make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui
735 make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui
736 that is passed to pre/post hooks
736 that is passed to pre/post hooks
737
737
738 $ echo '[hooks]' > .hg/hgrc
738 $ echo '[hooks]' > .hg/hgrc
739 $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc
739 $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc
740 $ hg id
740 $ hg id
741 cb9a9f314b8b
741 cb9a9f314b8b
742 $ hg id --verbose
742 $ hg id --verbose
743 calling hook pre-identify: hooktests.verbosehook
743 calling hook pre-identify: hooktests.verbosehook
744 verbose output from hook
744 verbose output from hook
745 cb9a9f314b8b
745 cb9a9f314b8b
746
746
747 Ensure hooks can be prioritized
747 Ensure hooks can be prioritized
748
748
749 $ echo '[hooks]' > .hg/hgrc
749 $ echo '[hooks]' > .hg/hgrc
750 $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc
750 $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc
751 $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc
751 $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc
752 $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc
752 $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc
753 $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc
753 $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc
754 $ hg id --verbose
754 $ hg id --verbose
755 calling hook pre-identify.b: hooktests.verbosehook
755 calling hook pre-identify.b: hooktests.verbosehook
756 verbose output from hook
756 verbose output from hook
757 calling hook pre-identify.a: hooktests.verbosehook
757 calling hook pre-identify.a: hooktests.verbosehook
758 verbose output from hook
758 verbose output from hook
759 calling hook pre-identify.c: hooktests.verbosehook
759 calling hook pre-identify.c: hooktests.verbosehook
760 verbose output from hook
760 verbose output from hook
761 cb9a9f314b8b
761 cb9a9f314b8b
762
762
763 new tags must be visible in pretxncommit (issue3210)
763 new tags must be visible in pretxncommit (issue3210)
764
764
765 $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc
765 $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc
766 $ hg tag -f foo
766 $ hg tag -f foo
767 ['a', 'foo', 'tip']
767 ['a', 'foo', 'tip']
768
768
769 post-init hooks must not crash (issue4983)
769 post-init hooks must not crash (issue4983)
770 This also creates the `to` repo for the next test block.
770 This also creates the `to` repo for the next test block.
771
771
772 $ cd ..
772 $ cd ..
773 $ cat << EOF >> hgrc-with-post-init-hook
773 $ cat << EOF >> hgrc-with-post-init-hook
774 > [hooks]
774 > [hooks]
775 > post-init = sh -c "printenv.py post-init"
775 > post-init = sh -c "printenv.py post-init"
776 > EOF
776 > EOF
777 $ HGRCPATH=hgrc-with-post-init-hook hg init to
777 $ HGRCPATH=hgrc-with-post-init-hook hg init to
778 post-init hook: HG_ARGS=init to HG_HOOKNAME=post-init HG_HOOKTYPE=post-init HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0
778 post-init hook: HG_ARGS=init to HG_HOOKNAME=post-init HG_HOOKTYPE=post-init HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0
779
779
780 new commits must be visible in pretxnchangegroup (issue3428)
780 new commits must be visible in pretxnchangegroup (issue3428)
781
781
782 $ echo '[hooks]' >> to/.hg/hgrc
782 $ echo '[hooks]' >> to/.hg/hgrc
783 $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc
783 $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc
784 $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc
784 $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc
785 $ echo a >> to/a
785 $ echo a >> to/a
786 $ hg --cwd to ci -Ama
786 $ hg --cwd to ci -Ama
787 adding a
787 adding a
788 $ hg clone to from
788 $ hg clone to from
789 updating to branch default
789 updating to branch default
790 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
790 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
791 $ echo aa >> from/a
791 $ echo aa >> from/a
792 $ hg --cwd from ci -mb
792 $ hg --cwd from ci -mb
793 $ hg --cwd from push
793 $ hg --cwd from push
794 pushing to $TESTTMP/to (glob)
794 pushing to $TESTTMP/to (glob)
795 searching for changes
795 searching for changes
796 changeset: 0:cb9a9f314b8b
796 changeset: 0:cb9a9f314b8b
797 tag: tip
797 tag: tip
798 user: test
798 user: test
799 date: Thu Jan 01 00:00:00 1970 +0000
799 date: Thu Jan 01 00:00:00 1970 +0000
800 summary: a
800 summary: a
801
801
802 adding changesets
802 adding changesets
803 adding manifests
803 adding manifests
804 adding file changes
804 adding file changes
805 added 1 changesets with 1 changes to 1 files
805 added 1 changesets with 1 changes to 1 files
806 changeset: 1:9836a07b9b9d
806 changeset: 1:9836a07b9b9d
807 tag: tip
807 tag: tip
808 user: test
808 user: test
809 date: Thu Jan 01 00:00:00 1970 +0000
809 date: Thu Jan 01 00:00:00 1970 +0000
810 summary: b
810 summary: b
811
811
812
812
813 pretxnclose hook failure should abort the transaction
813 pretxnclose hook failure should abort the transaction
814
814
815 $ hg init txnfailure
815 $ hg init txnfailure
816 $ cd txnfailure
816 $ cd txnfailure
817 $ touch a && hg commit -Aqm a
817 $ touch a && hg commit -Aqm a
818 $ cat >> .hg/hgrc <<EOF
818 $ cat >> .hg/hgrc <<EOF
819 > [hooks]
819 > [hooks]
820 > pretxnclose.error = exit 1
820 > pretxnclose.error = exit 1
821 > EOF
821 > EOF
822 $ hg strip -r 0 --config extensions.strip=
822 $ hg strip -r 0 --config extensions.strip=
823 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
823 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
824 saved backup bundle to * (glob)
824 saved backup bundle to * (glob)
825 transaction abort!
825 transaction abort!
826 rollback completed
826 rollback completed
827 strip failed, backup bundle stored in * (glob)
827 strip failed, backup bundle stored in * (glob)
828 abort: pretxnclose.error hook exited with status 1
828 abort: pretxnclose.error hook exited with status 1
829 [255]
829 [255]
830 $ hg recover
830 $ hg recover
831 no interrupted transaction available
831 no interrupted transaction available
832 [1]
832 [1]
833 $ cd ..
833 $ cd ..
834
834
835 check whether HG_PENDING makes pending changes only in related
835 check whether HG_PENDING makes pending changes only in related
836 repositories visible to an external hook.
836 repositories visible to an external hook.
837
837
838 (emulate a transaction running concurrently by copied
838 (emulate a transaction running concurrently by copied
839 .hg/store/00changelog.i.a in subsequent test)
839 .hg/store/00changelog.i.a in subsequent test)
840
840
841 $ cat > $TESTTMP/savepending.sh <<EOF
841 $ cat > $TESTTMP/savepending.sh <<EOF
842 > cp .hg/store/00changelog.i.a .hg/store/00changelog.i.a.saved
842 > cp .hg/store/00changelog.i.a .hg/store/00changelog.i.a.saved
843 > exit 1 # to avoid adding new revision for subsequent tests
843 > exit 1 # to avoid adding new revision for subsequent tests
844 > EOF
844 > EOF
845 $ cd a
845 $ cd a
846 $ hg tip -q
846 $ hg tip -q
847 4:539e4b31b6dc
847 4:539e4b31b6dc
848 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" commit -m "invisible"
848 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" commit -m "invisible"
849 transaction abort!
849 transaction abort!
850 rollback completed
850 rollback completed
851 abort: pretxnclose hook exited with status 1
851 abort: pretxnclose hook exited with status 1
852 [255]
852 [255]
853 $ cp .hg/store/00changelog.i.a.saved .hg/store/00changelog.i.a
853 $ cp .hg/store/00changelog.i.a.saved .hg/store/00changelog.i.a
854
854
855 (check (in)visibility of new changeset while transaction running in
855 (check (in)visibility of new changeset while transaction running in
856 repo)
856 repo)
857
857
858 $ cat > $TESTTMP/checkpending.sh <<EOF
858 $ cat > $TESTTMP/checkpending.sh <<EOF
859 > echo '@a'
859 > echo '@a'
860 > hg -R $TESTTMP/a tip -q
860 > hg -R "$TESTTMP/a" tip -q
861 > echo '@a/nested'
861 > echo '@a/nested'
862 > hg -R $TESTTMP/a/nested tip -q
862 > hg -R "$TESTTMP/a/nested" tip -q
863 > exit 1 # to avoid adding new revision for subsequent tests
863 > exit 1 # to avoid adding new revision for subsequent tests
864 > EOF
864 > EOF
865 $ hg init nested
865 $ hg init nested
866 $ cd nested
866 $ cd nested
867 $ echo a > a
867 $ echo a > a
868 $ hg add a
868 $ hg add a
869 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" commit -m '#0'
869 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" commit -m '#0'
870 @a
870 @a
871 4:539e4b31b6dc
871 4:539e4b31b6dc
872 @a/nested
872 @a/nested
873 0:bf5e395ced2c
873 0:bf5e395ced2c
874 transaction abort!
874 transaction abort!
875 rollback completed
875 rollback completed
876 abort: pretxnclose hook exited with status 1
876 abort: pretxnclose hook exited with status 1
877 [255]
877 [255]
878
878
879 Hook from untrusted hgrc are reported as failure
879 Hook from untrusted hgrc are reported as failure
880 ================================================
880 ================================================
881
881
882 $ cat << EOF > $TESTTMP/untrusted.py
882 $ cat << EOF > $TESTTMP/untrusted.py
883 > from mercurial import scmutil, util
883 > from mercurial import scmutil, util
884 > def uisetup(ui):
884 > def uisetup(ui):
885 > class untrustedui(ui.__class__):
885 > class untrustedui(ui.__class__):
886 > def _trusted(self, fp, f):
886 > def _trusted(self, fp, f):
887 > if util.normpath(fp.name).endswith('untrusted/.hg/hgrc'):
887 > if util.normpath(fp.name).endswith('untrusted/.hg/hgrc'):
888 > return False
888 > return False
889 > return super(untrustedui, self)._trusted(fp, f)
889 > return super(untrustedui, self)._trusted(fp, f)
890 > ui.__class__ = untrustedui
890 > ui.__class__ = untrustedui
891 > EOF
891 > EOF
892 $ cat << EOF >> $HGRCPATH
892 $ cat << EOF >> $HGRCPATH
893 > [extensions]
893 > [extensions]
894 > untrusted=$TESTTMP/untrusted.py
894 > untrusted=$TESTTMP/untrusted.py
895 > EOF
895 > EOF
896 $ hg init untrusted
896 $ hg init untrusted
897 $ cd untrusted
897 $ cd untrusted
898
898
899 Non-blocking hook
899 Non-blocking hook
900 -----------------
900 -----------------
901
901
902 $ cat << EOF >> .hg/hgrc
902 $ cat << EOF >> .hg/hgrc
903 > [hooks]
903 > [hooks]
904 > txnclose.testing=echo txnclose hook called
904 > txnclose.testing=echo txnclose hook called
905 > EOF
905 > EOF
906 $ touch a && hg commit -Aqm a
906 $ touch a && hg commit -Aqm a
907 warning: untrusted hook txnclose.testing not executed
907 warning: untrusted hook txnclose.testing not executed
908 $ hg log
908 $ hg log
909 changeset: 0:3903775176ed
909 changeset: 0:3903775176ed
910 tag: tip
910 tag: tip
911 user: test
911 user: test
912 date: Thu Jan 01 00:00:00 1970 +0000
912 date: Thu Jan 01 00:00:00 1970 +0000
913 summary: a
913 summary: a
914
914
915
915
916 Non-blocking hook
916 Non-blocking hook
917 -----------------
917 -----------------
918
918
919 $ cat << EOF >> .hg/hgrc
919 $ cat << EOF >> .hg/hgrc
920 > [hooks]
920 > [hooks]
921 > pretxnclose.testing=echo pre-txnclose hook called
921 > pretxnclose.testing=echo pre-txnclose hook called
922 > EOF
922 > EOF
923 $ touch b && hg commit -Aqm a
923 $ touch b && hg commit -Aqm a
924 transaction abort!
924 transaction abort!
925 rollback completed
925 rollback completed
926 abort: untrusted hook pretxnclose.testing not executed
926 abort: untrusted hook pretxnclose.testing not executed
927 (see 'hg help config.trusted')
927 (see 'hg help config.trusted')
928 [255]
928 [255]
929 $ hg log
929 $ hg log
930 changeset: 0:3903775176ed
930 changeset: 0:3903775176ed
931 tag: tip
931 tag: tip
932 user: test
932 user: test
933 date: Thu Jan 01 00:00:00 1970 +0000
933 date: Thu Jan 01 00:00:00 1970 +0000
934 summary: a
934 summary: a
935
935
@@ -1,628 +1,628 b''
1 $ hglog() { hg log --template "{rev} {phaseidx} {desc}\n" $*; }
1 $ hglog() { hg log --template "{rev} {phaseidx} {desc}\n" $*; }
2 $ mkcommit() {
2 $ mkcommit() {
3 > echo "$1" > "$1"
3 > echo "$1" > "$1"
4 > hg add "$1"
4 > hg add "$1"
5 > message="$1"
5 > message="$1"
6 > shift
6 > shift
7 > hg ci -m "$message" $*
7 > hg ci -m "$message" $*
8 > }
8 > }
9
9
10 $ hg init initialrepo
10 $ hg init initialrepo
11 $ cd initialrepo
11 $ cd initialrepo
12
12
13 Cannot change null revision phase
13 Cannot change null revision phase
14
14
15 $ hg phase --force --secret null
15 $ hg phase --force --secret null
16 abort: cannot change null revision phase
16 abort: cannot change null revision phase
17 [255]
17 [255]
18 $ hg phase null
18 $ hg phase null
19 -1: public
19 -1: public
20
20
21 $ mkcommit A
21 $ mkcommit A
22
22
23 New commit are draft by default
23 New commit are draft by default
24
24
25 $ hglog
25 $ hglog
26 0 1 A
26 0 1 A
27
27
28 Following commit are draft too
28 Following commit are draft too
29
29
30 $ mkcommit B
30 $ mkcommit B
31
31
32 $ hglog
32 $ hglog
33 1 1 B
33 1 1 B
34 0 1 A
34 0 1 A
35
35
36 Draft commit are properly created over public one:
36 Draft commit are properly created over public one:
37
37
38 $ hg phase --public .
38 $ hg phase --public .
39 $ hg phase
39 $ hg phase
40 1: public
40 1: public
41 $ hglog
41 $ hglog
42 1 0 B
42 1 0 B
43 0 0 A
43 0 0 A
44
44
45 $ mkcommit C
45 $ mkcommit C
46 $ mkcommit D
46 $ mkcommit D
47
47
48 $ hglog
48 $ hglog
49 3 1 D
49 3 1 D
50 2 1 C
50 2 1 C
51 1 0 B
51 1 0 B
52 0 0 A
52 0 0 A
53
53
54 Test creating changeset as secret
54 Test creating changeset as secret
55
55
56 $ mkcommit E --config phases.new-commit='secret'
56 $ mkcommit E --config phases.new-commit='secret'
57 $ hglog
57 $ hglog
58 4 2 E
58 4 2 E
59 3 1 D
59 3 1 D
60 2 1 C
60 2 1 C
61 1 0 B
61 1 0 B
62 0 0 A
62 0 0 A
63
63
64 Test the secret property is inherited
64 Test the secret property is inherited
65
65
66 $ mkcommit H
66 $ mkcommit H
67 $ hglog
67 $ hglog
68 5 2 H
68 5 2 H
69 4 2 E
69 4 2 E
70 3 1 D
70 3 1 D
71 2 1 C
71 2 1 C
72 1 0 B
72 1 0 B
73 0 0 A
73 0 0 A
74
74
75 Even on merge
75 Even on merge
76
76
77 $ hg up -q 1
77 $ hg up -q 1
78 $ mkcommit "B'"
78 $ mkcommit "B'"
79 created new head
79 created new head
80 $ hglog
80 $ hglog
81 6 1 B'
81 6 1 B'
82 5 2 H
82 5 2 H
83 4 2 E
83 4 2 E
84 3 1 D
84 3 1 D
85 2 1 C
85 2 1 C
86 1 0 B
86 1 0 B
87 0 0 A
87 0 0 A
88 $ hg merge 4 # E
88 $ hg merge 4 # E
89 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 (branch merge, don't forget to commit)
90 (branch merge, don't forget to commit)
91 $ hg phase
91 $ hg phase
92 6: draft
92 6: draft
93 4: secret
93 4: secret
94 $ hg ci -m "merge B' and E"
94 $ hg ci -m "merge B' and E"
95 $ hglog
95 $ hglog
96 7 2 merge B' and E
96 7 2 merge B' and E
97 6 1 B'
97 6 1 B'
98 5 2 H
98 5 2 H
99 4 2 E
99 4 2 E
100 3 1 D
100 3 1 D
101 2 1 C
101 2 1 C
102 1 0 B
102 1 0 B
103 0 0 A
103 0 0 A
104
104
105 Test secret changeset are not pushed
105 Test secret changeset are not pushed
106
106
107 $ hg init ../push-dest
107 $ hg init ../push-dest
108 $ cat > ../push-dest/.hg/hgrc << EOF
108 $ cat > ../push-dest/.hg/hgrc << EOF
109 > [phases]
109 > [phases]
110 > publish=False
110 > publish=False
111 > EOF
111 > EOF
112 $ hg outgoing ../push-dest --template='{rev} {phase} {desc|firstline}\n'
112 $ hg outgoing ../push-dest --template='{rev} {phase} {desc|firstline}\n'
113 comparing with ../push-dest
113 comparing with ../push-dest
114 searching for changes
114 searching for changes
115 0 public A
115 0 public A
116 1 public B
116 1 public B
117 2 draft C
117 2 draft C
118 3 draft D
118 3 draft D
119 6 draft B'
119 6 draft B'
120 $ hg outgoing -r 'branch(default)' ../push-dest --template='{rev} {phase} {desc|firstline}\n'
120 $ hg outgoing -r 'branch(default)' ../push-dest --template='{rev} {phase} {desc|firstline}\n'
121 comparing with ../push-dest
121 comparing with ../push-dest
122 searching for changes
122 searching for changes
123 0 public A
123 0 public A
124 1 public B
124 1 public B
125 2 draft C
125 2 draft C
126 3 draft D
126 3 draft D
127 6 draft B'
127 6 draft B'
128
128
129 $ hg push ../push-dest -f # force because we push multiple heads
129 $ hg push ../push-dest -f # force because we push multiple heads
130 pushing to ../push-dest
130 pushing to ../push-dest
131 searching for changes
131 searching for changes
132 adding changesets
132 adding changesets
133 adding manifests
133 adding manifests
134 adding file changes
134 adding file changes
135 added 5 changesets with 5 changes to 5 files (+1 heads)
135 added 5 changesets with 5 changes to 5 files (+1 heads)
136 $ hglog
136 $ hglog
137 7 2 merge B' and E
137 7 2 merge B' and E
138 6 1 B'
138 6 1 B'
139 5 2 H
139 5 2 H
140 4 2 E
140 4 2 E
141 3 1 D
141 3 1 D
142 2 1 C
142 2 1 C
143 1 0 B
143 1 0 B
144 0 0 A
144 0 0 A
145 $ cd ../push-dest
145 $ cd ../push-dest
146 $ hglog
146 $ hglog
147 4 1 B'
147 4 1 B'
148 3 1 D
148 3 1 D
149 2 1 C
149 2 1 C
150 1 0 B
150 1 0 B
151 0 0 A
151 0 0 A
152
152
153 (Issue3303)
153 (Issue3303)
154 Check that remote secret changeset are ignore when checking creation of remote heads
154 Check that remote secret changeset are ignore when checking creation of remote heads
155
155
156 We add a secret head into the push destination. This secret head shadows a
156 We add a secret head into the push destination. This secret head shadows a
157 visible shared between the initial repo and the push destination.
157 visible shared between the initial repo and the push destination.
158
158
159 $ hg up -q 4 # B'
159 $ hg up -q 4 # B'
160 $ mkcommit Z --config phases.new-commit=secret
160 $ mkcommit Z --config phases.new-commit=secret
161 $ hg phase .
161 $ hg phase .
162 5: secret
162 5: secret
163
163
164 We now try to push a new public changeset that descend from the common public
164 We now try to push a new public changeset that descend from the common public
165 head shadowed by the remote secret head.
165 head shadowed by the remote secret head.
166
166
167 $ cd ../initialrepo
167 $ cd ../initialrepo
168 $ hg up -q 6 #B'
168 $ hg up -q 6 #B'
169 $ mkcommit I
169 $ mkcommit I
170 created new head
170 created new head
171 $ hg push ../push-dest
171 $ hg push ../push-dest
172 pushing to ../push-dest
172 pushing to ../push-dest
173 searching for changes
173 searching for changes
174 adding changesets
174 adding changesets
175 adding manifests
175 adding manifests
176 adding file changes
176 adding file changes
177 added 1 changesets with 1 changes to 1 files (+1 heads)
177 added 1 changesets with 1 changes to 1 files (+1 heads)
178
178
179 :note: The "(+1 heads)" is wrong as we do not had any visible head
179 :note: The "(+1 heads)" is wrong as we do not had any visible head
180
180
181 check that branch cache with "served" filter are properly computed and stored
181 check that branch cache with "served" filter are properly computed and stored
182
182
183 $ ls ../push-dest/.hg/cache/branch2*
183 $ ls ../push-dest/.hg/cache/branch2*
184 ../push-dest/.hg/cache/branch2-served
184 ../push-dest/.hg/cache/branch2-served
185 $ cat ../push-dest/.hg/cache/branch2-served
185 $ cat ../push-dest/.hg/cache/branch2-served
186 6d6770faffce199f1fddd1cf87f6f026138cf061 6 465891ffab3c47a3c23792f7dc84156e19a90722
186 6d6770faffce199f1fddd1cf87f6f026138cf061 6 465891ffab3c47a3c23792f7dc84156e19a90722
187 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
187 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
188 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
188 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
189 $ hg heads -R ../push-dest --template '{rev}:{node} {phase}\n' #update visible cache too
189 $ hg heads -R ../push-dest --template '{rev}:{node} {phase}\n' #update visible cache too
190 6:6d6770faffce199f1fddd1cf87f6f026138cf061 draft
190 6:6d6770faffce199f1fddd1cf87f6f026138cf061 draft
191 5:2713879da13d6eea1ff22b442a5a87cb31a7ce6a secret
191 5:2713879da13d6eea1ff22b442a5a87cb31a7ce6a secret
192 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e draft
192 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e draft
193 $ ls ../push-dest/.hg/cache/branch2*
193 $ ls ../push-dest/.hg/cache/branch2*
194 ../push-dest/.hg/cache/branch2-served
194 ../push-dest/.hg/cache/branch2-served
195 ../push-dest/.hg/cache/branch2-visible
195 ../push-dest/.hg/cache/branch2-visible
196 $ cat ../push-dest/.hg/cache/branch2-served
196 $ cat ../push-dest/.hg/cache/branch2-served
197 6d6770faffce199f1fddd1cf87f6f026138cf061 6 465891ffab3c47a3c23792f7dc84156e19a90722
197 6d6770faffce199f1fddd1cf87f6f026138cf061 6 465891ffab3c47a3c23792f7dc84156e19a90722
198 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
198 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
199 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
199 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
200 $ cat ../push-dest/.hg/cache/branch2-visible
200 $ cat ../push-dest/.hg/cache/branch2-visible
201 6d6770faffce199f1fddd1cf87f6f026138cf061 6
201 6d6770faffce199f1fddd1cf87f6f026138cf061 6
202 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
202 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
203 2713879da13d6eea1ff22b442a5a87cb31a7ce6a o default
203 2713879da13d6eea1ff22b442a5a87cb31a7ce6a o default
204 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
204 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
205
205
206
206
207 Restore condition prior extra insertion.
207 Restore condition prior extra insertion.
208 $ hg -q --config extensions.mq= strip .
208 $ hg -q --config extensions.mq= strip .
209 $ hg up -q 7
209 $ hg up -q 7
210 $ cd ..
210 $ cd ..
211
211
212 Test secret changeset are not pull
212 Test secret changeset are not pull
213
213
214 $ hg init pull-dest
214 $ hg init pull-dest
215 $ cd pull-dest
215 $ cd pull-dest
216 $ hg pull ../initialrepo
216 $ hg pull ../initialrepo
217 pulling from ../initialrepo
217 pulling from ../initialrepo
218 requesting all changes
218 requesting all changes
219 adding changesets
219 adding changesets
220 adding manifests
220 adding manifests
221 adding file changes
221 adding file changes
222 added 5 changesets with 5 changes to 5 files (+1 heads)
222 added 5 changesets with 5 changes to 5 files (+1 heads)
223 (run 'hg heads' to see heads, 'hg merge' to merge)
223 (run 'hg heads' to see heads, 'hg merge' to merge)
224 $ hglog
224 $ hglog
225 4 0 B'
225 4 0 B'
226 3 0 D
226 3 0 D
227 2 0 C
227 2 0 C
228 1 0 B
228 1 0 B
229 0 0 A
229 0 0 A
230 $ cd ..
230 $ cd ..
231
231
232 But secret can still be bundled explicitly
232 But secret can still be bundled explicitly
233
233
234 $ cd initialrepo
234 $ cd initialrepo
235 $ hg bundle --base '4^' -r 'children(4)' ../secret-bundle.hg
235 $ hg bundle --base '4^' -r 'children(4)' ../secret-bundle.hg
236 4 changesets found
236 4 changesets found
237 $ cd ..
237 $ cd ..
238
238
239 Test secret changeset are not cloned
239 Test secret changeset are not cloned
240 (during local clone)
240 (during local clone)
241
241
242 $ hg clone -qU initialrepo clone-dest
242 $ hg clone -qU initialrepo clone-dest
243 $ hglog -R clone-dest
243 $ hglog -R clone-dest
244 4 0 B'
244 4 0 B'
245 3 0 D
245 3 0 D
246 2 0 C
246 2 0 C
247 1 0 B
247 1 0 B
248 0 0 A
248 0 0 A
249
249
250 Test summary
250 Test summary
251
251
252 $ hg summary -R clone-dest --verbose
252 $ hg summary -R clone-dest --verbose
253 parent: -1:000000000000 (no revision checked out)
253 parent: -1:000000000000 (no revision checked out)
254 branch: default
254 branch: default
255 commit: (clean)
255 commit: (clean)
256 update: 5 new changesets (update)
256 update: 5 new changesets (update)
257 $ hg summary -R initialrepo
257 $ hg summary -R initialrepo
258 parent: 7:17a481b3bccb tip
258 parent: 7:17a481b3bccb tip
259 merge B' and E
259 merge B' and E
260 branch: default
260 branch: default
261 commit: (clean) (secret)
261 commit: (clean) (secret)
262 update: 1 new changesets, 2 branch heads (merge)
262 update: 1 new changesets, 2 branch heads (merge)
263 phases: 3 draft, 3 secret
263 phases: 3 draft, 3 secret
264 $ hg summary -R initialrepo --quiet
264 $ hg summary -R initialrepo --quiet
265 parent: 7:17a481b3bccb tip
265 parent: 7:17a481b3bccb tip
266 update: 1 new changesets, 2 branch heads (merge)
266 update: 1 new changesets, 2 branch heads (merge)
267
267
268 Test revset
268 Test revset
269
269
270 $ cd initialrepo
270 $ cd initialrepo
271 $ hglog -r 'public()'
271 $ hglog -r 'public()'
272 0 0 A
272 0 0 A
273 1 0 B
273 1 0 B
274 $ hglog -r 'draft()'
274 $ hglog -r 'draft()'
275 2 1 C
275 2 1 C
276 3 1 D
276 3 1 D
277 6 1 B'
277 6 1 B'
278 $ hglog -r 'secret()'
278 $ hglog -r 'secret()'
279 4 2 E
279 4 2 E
280 5 2 H
280 5 2 H
281 7 2 merge B' and E
281 7 2 merge B' and E
282
282
283 test that phase are displayed in log at debug level
283 test that phase are displayed in log at debug level
284
284
285 $ hg log --debug
285 $ hg log --debug
286 changeset: 7:17a481b3bccb796c0521ae97903d81c52bfee4af
286 changeset: 7:17a481b3bccb796c0521ae97903d81c52bfee4af
287 tag: tip
287 tag: tip
288 phase: secret
288 phase: secret
289 parent: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
289 parent: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
290 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
290 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
291 manifest: 7:5e724ffacba267b2ab726c91fc8b650710deaaa8
291 manifest: 7:5e724ffacba267b2ab726c91fc8b650710deaaa8
292 user: test
292 user: test
293 date: Thu Jan 01 00:00:00 1970 +0000
293 date: Thu Jan 01 00:00:00 1970 +0000
294 files+: C D E
294 files+: C D E
295 extra: branch=default
295 extra: branch=default
296 description:
296 description:
297 merge B' and E
297 merge B' and E
298
298
299
299
300 changeset: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
300 changeset: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
301 phase: draft
301 phase: draft
302 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
302 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
303 parent: -1:0000000000000000000000000000000000000000
303 parent: -1:0000000000000000000000000000000000000000
304 manifest: 6:ab8bfef2392903058bf4ebb9e7746e8d7026b27a
304 manifest: 6:ab8bfef2392903058bf4ebb9e7746e8d7026b27a
305 user: test
305 user: test
306 date: Thu Jan 01 00:00:00 1970 +0000
306 date: Thu Jan 01 00:00:00 1970 +0000
307 files+: B'
307 files+: B'
308 extra: branch=default
308 extra: branch=default
309 description:
309 description:
310 B'
310 B'
311
311
312
312
313 changeset: 5:a030c6be5127abc010fcbff1851536552e6951a8
313 changeset: 5:a030c6be5127abc010fcbff1851536552e6951a8
314 phase: secret
314 phase: secret
315 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
315 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
316 parent: -1:0000000000000000000000000000000000000000
316 parent: -1:0000000000000000000000000000000000000000
317 manifest: 5:5c710aa854874fe3d5fa7192e77bdb314cc08b5a
317 manifest: 5:5c710aa854874fe3d5fa7192e77bdb314cc08b5a
318 user: test
318 user: test
319 date: Thu Jan 01 00:00:00 1970 +0000
319 date: Thu Jan 01 00:00:00 1970 +0000
320 files+: H
320 files+: H
321 extra: branch=default
321 extra: branch=default
322 description:
322 description:
323 H
323 H
324
324
325
325
326 changeset: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
326 changeset: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
327 phase: secret
327 phase: secret
328 parent: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
328 parent: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
329 parent: -1:0000000000000000000000000000000000000000
329 parent: -1:0000000000000000000000000000000000000000
330 manifest: 4:7173fd1c27119750b959e3a0f47ed78abe75d6dc
330 manifest: 4:7173fd1c27119750b959e3a0f47ed78abe75d6dc
331 user: test
331 user: test
332 date: Thu Jan 01 00:00:00 1970 +0000
332 date: Thu Jan 01 00:00:00 1970 +0000
333 files+: E
333 files+: E
334 extra: branch=default
334 extra: branch=default
335 description:
335 description:
336 E
336 E
337
337
338
338
339 changeset: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
339 changeset: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
340 phase: draft
340 phase: draft
341 parent: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
341 parent: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
342 parent: -1:0000000000000000000000000000000000000000
342 parent: -1:0000000000000000000000000000000000000000
343 manifest: 3:6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c
343 manifest: 3:6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c
344 user: test
344 user: test
345 date: Thu Jan 01 00:00:00 1970 +0000
345 date: Thu Jan 01 00:00:00 1970 +0000
346 files+: D
346 files+: D
347 extra: branch=default
347 extra: branch=default
348 description:
348 description:
349 D
349 D
350
350
351
351
352 changeset: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
352 changeset: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
353 phase: draft
353 phase: draft
354 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
354 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
355 parent: -1:0000000000000000000000000000000000000000
355 parent: -1:0000000000000000000000000000000000000000
356 manifest: 2:66a5a01817fdf5239c273802b5b7618d051c89e4
356 manifest: 2:66a5a01817fdf5239c273802b5b7618d051c89e4
357 user: test
357 user: test
358 date: Thu Jan 01 00:00:00 1970 +0000
358 date: Thu Jan 01 00:00:00 1970 +0000
359 files+: C
359 files+: C
360 extra: branch=default
360 extra: branch=default
361 description:
361 description:
362 C
362 C
363
363
364
364
365 changeset: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
365 changeset: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
366 phase: public
366 phase: public
367 parent: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
367 parent: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
368 parent: -1:0000000000000000000000000000000000000000
368 parent: -1:0000000000000000000000000000000000000000
369 manifest: 1:cb5cbbc1bfbf24cc34b9e8c16914e9caa2d2a7fd
369 manifest: 1:cb5cbbc1bfbf24cc34b9e8c16914e9caa2d2a7fd
370 user: test
370 user: test
371 date: Thu Jan 01 00:00:00 1970 +0000
371 date: Thu Jan 01 00:00:00 1970 +0000
372 files+: B
372 files+: B
373 extra: branch=default
373 extra: branch=default
374 description:
374 description:
375 B
375 B
376
376
377
377
378 changeset: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
378 changeset: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
379 phase: public
379 phase: public
380 parent: -1:0000000000000000000000000000000000000000
380 parent: -1:0000000000000000000000000000000000000000
381 parent: -1:0000000000000000000000000000000000000000
381 parent: -1:0000000000000000000000000000000000000000
382 manifest: 0:007d8c9d88841325f5c6b06371b35b4e8a2b1a83
382 manifest: 0:007d8c9d88841325f5c6b06371b35b4e8a2b1a83
383 user: test
383 user: test
384 date: Thu Jan 01 00:00:00 1970 +0000
384 date: Thu Jan 01 00:00:00 1970 +0000
385 files+: A
385 files+: A
386 extra: branch=default
386 extra: branch=default
387 description:
387 description:
388 A
388 A
389
389
390
390
391
391
392
392
393 (Issue3707)
393 (Issue3707)
394 test invalid phase name
394 test invalid phase name
395
395
396 $ mkcommit I --config phases.new-commit='babar'
396 $ mkcommit I --config phases.new-commit='babar'
397 transaction abort!
397 transaction abort!
398 rollback completed
398 rollback completed
399 abort: phases.new-commit: not a valid phase name ('babar')
399 abort: phases.new-commit: not a valid phase name ('babar')
400 [255]
400 [255]
401 Test phase command
401 Test phase command
402 ===================
402 ===================
403
403
404 initial picture
404 initial picture
405
405
406 $ hg log -G --template "{rev} {phase} {desc}\n"
406 $ hg log -G --template "{rev} {phase} {desc}\n"
407 @ 7 secret merge B' and E
407 @ 7 secret merge B' and E
408 |\
408 |\
409 | o 6 draft B'
409 | o 6 draft B'
410 | |
410 | |
411 +---o 5 secret H
411 +---o 5 secret H
412 | |
412 | |
413 o | 4 secret E
413 o | 4 secret E
414 | |
414 | |
415 o | 3 draft D
415 o | 3 draft D
416 | |
416 | |
417 o | 2 draft C
417 o | 2 draft C
418 |/
418 |/
419 o 1 public B
419 o 1 public B
420 |
420 |
421 o 0 public A
421 o 0 public A
422
422
423
423
424 display changesets phase
424 display changesets phase
425
425
426 (mixing -r and plain rev specification)
426 (mixing -r and plain rev specification)
427
427
428 $ hg phase 1::4 -r 7
428 $ hg phase 1::4 -r 7
429 1: public
429 1: public
430 2: draft
430 2: draft
431 3: draft
431 3: draft
432 4: secret
432 4: secret
433 7: secret
433 7: secret
434
434
435
435
436 move changeset forward
436 move changeset forward
437
437
438 (with -r option)
438 (with -r option)
439
439
440 $ hg phase --public -r 2
440 $ hg phase --public -r 2
441 $ hg log -G --template "{rev} {phase} {desc}\n"
441 $ hg log -G --template "{rev} {phase} {desc}\n"
442 @ 7 secret merge B' and E
442 @ 7 secret merge B' and E
443 |\
443 |\
444 | o 6 draft B'
444 | o 6 draft B'
445 | |
445 | |
446 +---o 5 secret H
446 +---o 5 secret H
447 | |
447 | |
448 o | 4 secret E
448 o | 4 secret E
449 | |
449 | |
450 o | 3 draft D
450 o | 3 draft D
451 | |
451 | |
452 o | 2 public C
452 o | 2 public C
453 |/
453 |/
454 o 1 public B
454 o 1 public B
455 |
455 |
456 o 0 public A
456 o 0 public A
457
457
458
458
459 move changeset backward
459 move changeset backward
460
460
461 (without -r option)
461 (without -r option)
462
462
463 $ hg phase --draft --force 2
463 $ hg phase --draft --force 2
464 $ hg log -G --template "{rev} {phase} {desc}\n"
464 $ hg log -G --template "{rev} {phase} {desc}\n"
465 @ 7 secret merge B' and E
465 @ 7 secret merge B' and E
466 |\
466 |\
467 | o 6 draft B'
467 | o 6 draft B'
468 | |
468 | |
469 +---o 5 secret H
469 +---o 5 secret H
470 | |
470 | |
471 o | 4 secret E
471 o | 4 secret E
472 | |
472 | |
473 o | 3 draft D
473 o | 3 draft D
474 | |
474 | |
475 o | 2 draft C
475 o | 2 draft C
476 |/
476 |/
477 o 1 public B
477 o 1 public B
478 |
478 |
479 o 0 public A
479 o 0 public A
480
480
481
481
482 move changeset forward and backward
482 move changeset forward and backward
483
483
484 $ hg phase --draft --force 1::4
484 $ hg phase --draft --force 1::4
485 $ hg log -G --template "{rev} {phase} {desc}\n"
485 $ hg log -G --template "{rev} {phase} {desc}\n"
486 @ 7 secret merge B' and E
486 @ 7 secret merge B' and E
487 |\
487 |\
488 | o 6 draft B'
488 | o 6 draft B'
489 | |
489 | |
490 +---o 5 secret H
490 +---o 5 secret H
491 | |
491 | |
492 o | 4 draft E
492 o | 4 draft E
493 | |
493 | |
494 o | 3 draft D
494 o | 3 draft D
495 | |
495 | |
496 o | 2 draft C
496 o | 2 draft C
497 |/
497 |/
498 o 1 draft B
498 o 1 draft B
499 |
499 |
500 o 0 public A
500 o 0 public A
501
501
502 test partial failure
502 test partial failure
503
503
504 $ hg phase --public 7
504 $ hg phase --public 7
505 $ hg phase --draft '5 or 7'
505 $ hg phase --draft '5 or 7'
506 cannot move 1 changesets to a higher phase, use --force
506 cannot move 1 changesets to a higher phase, use --force
507 phase changed for 1 changesets
507 phase changed for 1 changesets
508 [1]
508 [1]
509 $ hg log -G --template "{rev} {phase} {desc}\n"
509 $ hg log -G --template "{rev} {phase} {desc}\n"
510 @ 7 public merge B' and E
510 @ 7 public merge B' and E
511 |\
511 |\
512 | o 6 public B'
512 | o 6 public B'
513 | |
513 | |
514 +---o 5 draft H
514 +---o 5 draft H
515 | |
515 | |
516 o | 4 public E
516 o | 4 public E
517 | |
517 | |
518 o | 3 public D
518 o | 3 public D
519 | |
519 | |
520 o | 2 public C
520 o | 2 public C
521 |/
521 |/
522 o 1 public B
522 o 1 public B
523 |
523 |
524 o 0 public A
524 o 0 public A
525
525
526
526
527 test complete failure
527 test complete failure
528
528
529 $ hg phase --draft 7
529 $ hg phase --draft 7
530 cannot move 1 changesets to a higher phase, use --force
530 cannot move 1 changesets to a higher phase, use --force
531 no phases changed
531 no phases changed
532 [1]
532 [1]
533
533
534 $ cd ..
534 $ cd ..
535
535
536 test hidden changeset are not cloned as public (issue3935)
536 test hidden changeset are not cloned as public (issue3935)
537
537
538 $ cd initialrepo
538 $ cd initialrepo
539
539
540 (enabling evolution)
540 (enabling evolution)
541 $ cat >> $HGRCPATH << EOF
541 $ cat >> $HGRCPATH << EOF
542 > [experimental]
542 > [experimental]
543 > evolution=createmarkers
543 > evolution=createmarkers
544 > EOF
544 > EOF
545
545
546 (making a changeset hidden; H in that case)
546 (making a changeset hidden; H in that case)
547 $ hg debugobsolete `hg id --debug -r 5`
547 $ hg debugobsolete `hg id --debug -r 5`
548
548
549 $ cd ..
549 $ cd ..
550 $ hg clone initialrepo clonewithobs
550 $ hg clone initialrepo clonewithobs
551 requesting all changes
551 requesting all changes
552 adding changesets
552 adding changesets
553 adding manifests
553 adding manifests
554 adding file changes
554 adding file changes
555 added 7 changesets with 6 changes to 6 files
555 added 7 changesets with 6 changes to 6 files
556 updating to branch default
556 updating to branch default
557 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
557 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
558 $ cd clonewithobs
558 $ cd clonewithobs
559 $ hg log -G --template "{rev} {phase} {desc}\n"
559 $ hg log -G --template "{rev} {phase} {desc}\n"
560 @ 6 public merge B' and E
560 @ 6 public merge B' and E
561 |\
561 |\
562 | o 5 public B'
562 | o 5 public B'
563 | |
563 | |
564 o | 4 public E
564 o | 4 public E
565 | |
565 | |
566 o | 3 public D
566 o | 3 public D
567 | |
567 | |
568 o | 2 public C
568 o | 2 public C
569 |/
569 |/
570 o 1 public B
570 o 1 public B
571 |
571 |
572 o 0 public A
572 o 0 public A
573
573
574
574
575 test verify repo containing hidden changesets, which should not abort just
575 test verify repo containing hidden changesets, which should not abort just
576 because repo.cancopy() is False
576 because repo.cancopy() is False
577
577
578 $ cd ../initialrepo
578 $ cd ../initialrepo
579 $ hg verify
579 $ hg verify
580 checking changesets
580 checking changesets
581 checking manifests
581 checking manifests
582 crosschecking files in changesets and manifests
582 crosschecking files in changesets and manifests
583 checking files
583 checking files
584 7 files, 8 changesets, 7 total revisions
584 7 files, 8 changesets, 7 total revisions
585
585
586 $ cd ..
586 $ cd ..
587
587
588 check whether HG_PENDING makes pending changes only in related
588 check whether HG_PENDING makes pending changes only in related
589 repositories visible to an external hook.
589 repositories visible to an external hook.
590
590
591 (emulate a transaction running concurrently by copied
591 (emulate a transaction running concurrently by copied
592 .hg/phaseroots.pending in subsequent test)
592 .hg/phaseroots.pending in subsequent test)
593
593
594 $ cat > $TESTTMP/savepending.sh <<EOF
594 $ cat > $TESTTMP/savepending.sh <<EOF
595 > cp .hg/store/phaseroots.pending .hg/store/phaseroots.pending.saved
595 > cp .hg/store/phaseroots.pending .hg/store/phaseroots.pending.saved
596 > exit 1 # to avoid changing phase for subsequent tests
596 > exit 1 # to avoid changing phase for subsequent tests
597 > EOF
597 > EOF
598 $ cd push-dest
598 $ cd push-dest
599 $ hg phase 6
599 $ hg phase 6
600 6: draft
600 6: draft
601 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" phase -f -s 6
601 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" phase -f -s 6
602 transaction abort!
602 transaction abort!
603 rollback completed
603 rollback completed
604 abort: pretxnclose hook exited with status 1
604 abort: pretxnclose hook exited with status 1
605 [255]
605 [255]
606 $ cp .hg/store/phaseroots.pending.saved .hg/store/phaseroots.pending
606 $ cp .hg/store/phaseroots.pending.saved .hg/store/phaseroots.pending
607
607
608 (check (in)visibility of phaseroot while transaction running in repo)
608 (check (in)visibility of phaseroot while transaction running in repo)
609
609
610 $ cat > $TESTTMP/checkpending.sh <<EOF
610 $ cat > $TESTTMP/checkpending.sh <<EOF
611 > echo '@initialrepo'
611 > echo '@initialrepo'
612 > hg -R $TESTTMP/initialrepo phase 7
612 > hg -R "$TESTTMP/initialrepo" phase 7
613 > echo '@push-dest'
613 > echo '@push-dest'
614 > hg -R $TESTTMP/push-dest phase 6
614 > hg -R "$TESTTMP/push-dest" phase 6
615 > exit 1 # to avoid changing phase for subsequent tests
615 > exit 1 # to avoid changing phase for subsequent tests
616 > EOF
616 > EOF
617 $ cd ../initialrepo
617 $ cd ../initialrepo
618 $ hg phase 7
618 $ hg phase 7
619 7: public
619 7: public
620 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" phase -f -s 7
620 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" phase -f -s 7
621 @initialrepo
621 @initialrepo
622 7: secret
622 7: secret
623 @push-dest
623 @push-dest
624 6: draft
624 6: draft
625 transaction abort!
625 transaction abort!
626 rollback completed
626 rollback completed
627 abort: pretxnclose hook exited with status 1
627 abort: pretxnclose hook exited with status 1
628 [255]
628 [255]
@@ -1,416 +1,416 b''
1 #require killdaemons
1 #require killdaemons
2
2
3 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "share = " >> $HGRCPATH
4 $ echo "share = " >> $HGRCPATH
5
5
6 prepare repo1
6 prepare repo1
7
7
8 $ hg init repo1
8 $ hg init repo1
9 $ cd repo1
9 $ cd repo1
10 $ echo a > a
10 $ echo a > a
11 $ hg commit -A -m'init'
11 $ hg commit -A -m'init'
12 adding a
12 adding a
13
13
14 share it
14 share it
15
15
16 $ cd ..
16 $ cd ..
17 $ hg share repo1 repo2
17 $ hg share repo1 repo2
18 updating working directory
18 updating working directory
19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20
20
21 share shouldn't have a store dir
21 share shouldn't have a store dir
22
22
23 $ cd repo2
23 $ cd repo2
24 $ test -d .hg/store
24 $ test -d .hg/store
25 [1]
25 [1]
26
26
27 Some sed versions appends newline, some don't, and some just fails
27 Some sed versions appends newline, some don't, and some just fails
28
28
29 $ cat .hg/sharedpath; echo
29 $ cat .hg/sharedpath; echo
30 $TESTTMP/repo1/.hg (glob)
30 $TESTTMP/repo1/.hg (glob)
31
31
32 trailing newline on .hg/sharedpath is ok
32 trailing newline on .hg/sharedpath is ok
33 $ hg tip -q
33 $ hg tip -q
34 0:d3873e73d99e
34 0:d3873e73d99e
35 $ echo '' >> .hg/sharedpath
35 $ echo '' >> .hg/sharedpath
36 $ cat .hg/sharedpath
36 $ cat .hg/sharedpath
37 $TESTTMP/repo1/.hg (glob)
37 $TESTTMP/repo1/.hg (glob)
38 $ hg tip -q
38 $ hg tip -q
39 0:d3873e73d99e
39 0:d3873e73d99e
40
40
41 commit in shared clone
41 commit in shared clone
42
42
43 $ echo a >> a
43 $ echo a >> a
44 $ hg commit -m'change in shared clone'
44 $ hg commit -m'change in shared clone'
45
45
46 check original
46 check original
47
47
48 $ cd ../repo1
48 $ cd ../repo1
49 $ hg log
49 $ hg log
50 changeset: 1:8af4dc49db9e
50 changeset: 1:8af4dc49db9e
51 tag: tip
51 tag: tip
52 user: test
52 user: test
53 date: Thu Jan 01 00:00:00 1970 +0000
53 date: Thu Jan 01 00:00:00 1970 +0000
54 summary: change in shared clone
54 summary: change in shared clone
55
55
56 changeset: 0:d3873e73d99e
56 changeset: 0:d3873e73d99e
57 user: test
57 user: test
58 date: Thu Jan 01 00:00:00 1970 +0000
58 date: Thu Jan 01 00:00:00 1970 +0000
59 summary: init
59 summary: init
60
60
61 $ hg update
61 $ hg update
62 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 $ cat a # should be two lines of "a"
63 $ cat a # should be two lines of "a"
64 a
64 a
65 a
65 a
66
66
67 commit in original
67 commit in original
68
68
69 $ echo b > b
69 $ echo b > b
70 $ hg commit -A -m'another file'
70 $ hg commit -A -m'another file'
71 adding b
71 adding b
72
72
73 check in shared clone
73 check in shared clone
74
74
75 $ cd ../repo2
75 $ cd ../repo2
76 $ hg log
76 $ hg log
77 changeset: 2:c2e0ac586386
77 changeset: 2:c2e0ac586386
78 tag: tip
78 tag: tip
79 user: test
79 user: test
80 date: Thu Jan 01 00:00:00 1970 +0000
80 date: Thu Jan 01 00:00:00 1970 +0000
81 summary: another file
81 summary: another file
82
82
83 changeset: 1:8af4dc49db9e
83 changeset: 1:8af4dc49db9e
84 user: test
84 user: test
85 date: Thu Jan 01 00:00:00 1970 +0000
85 date: Thu Jan 01 00:00:00 1970 +0000
86 summary: change in shared clone
86 summary: change in shared clone
87
87
88 changeset: 0:d3873e73d99e
88 changeset: 0:d3873e73d99e
89 user: test
89 user: test
90 date: Thu Jan 01 00:00:00 1970 +0000
90 date: Thu Jan 01 00:00:00 1970 +0000
91 summary: init
91 summary: init
92
92
93 $ hg update
93 $ hg update
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 $ cat b # should exist with one "b"
95 $ cat b # should exist with one "b"
96 b
96 b
97
97
98 hg serve shared clone
98 hg serve shared clone
99
99
100 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid
100 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid
101 $ cat hg.pid >> $DAEMON_PIDS
101 $ cat hg.pid >> $DAEMON_PIDS
102 $ get-with-headers.py localhost:$HGPORT 'raw-file/'
102 $ get-with-headers.py localhost:$HGPORT 'raw-file/'
103 200 Script output follows
103 200 Script output follows
104
104
105
105
106 -rw-r--r-- 4 a
106 -rw-r--r-- 4 a
107 -rw-r--r-- 2 b
107 -rw-r--r-- 2 b
108
108
109
109
110
110
111 test unshare command
111 test unshare command
112
112
113 $ hg unshare
113 $ hg unshare
114 $ test -d .hg/store
114 $ test -d .hg/store
115 $ test -f .hg/sharedpath
115 $ test -f .hg/sharedpath
116 [1]
116 [1]
117 $ grep shared .hg/requires
117 $ grep shared .hg/requires
118 [1]
118 [1]
119 $ hg unshare
119 $ hg unshare
120 abort: this is not a shared repo
120 abort: this is not a shared repo
121 [255]
121 [255]
122
122
123 check that a change does not propagate
123 check that a change does not propagate
124
124
125 $ echo b >> b
125 $ echo b >> b
126 $ hg commit -m'change in unshared'
126 $ hg commit -m'change in unshared'
127 $ cd ../repo1
127 $ cd ../repo1
128 $ hg id -r tip
128 $ hg id -r tip
129 c2e0ac586386 tip
129 c2e0ac586386 tip
130
130
131 $ cd ..
131 $ cd ..
132
132
133
133
134 test sharing bookmarks
134 test sharing bookmarks
135
135
136 $ hg share -B repo1 repo3
136 $ hg share -B repo1 repo3
137 updating working directory
137 updating working directory
138 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
138 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 $ cd repo1
139 $ cd repo1
140 $ hg bookmark bm1
140 $ hg bookmark bm1
141 $ hg bookmarks
141 $ hg bookmarks
142 * bm1 2:c2e0ac586386
142 * bm1 2:c2e0ac586386
143 $ cd ../repo2
143 $ cd ../repo2
144 $ hg book bm2
144 $ hg book bm2
145 $ hg bookmarks
145 $ hg bookmarks
146 * bm2 3:0e6e70d1d5f1
146 * bm2 3:0e6e70d1d5f1
147 $ cd ../repo3
147 $ cd ../repo3
148 $ hg bookmarks
148 $ hg bookmarks
149 bm1 2:c2e0ac586386
149 bm1 2:c2e0ac586386
150 $ hg book bm3
150 $ hg book bm3
151 $ hg bookmarks
151 $ hg bookmarks
152 bm1 2:c2e0ac586386
152 bm1 2:c2e0ac586386
153 * bm3 2:c2e0ac586386
153 * bm3 2:c2e0ac586386
154 $ cd ../repo1
154 $ cd ../repo1
155 $ hg bookmarks
155 $ hg bookmarks
156 * bm1 2:c2e0ac586386
156 * bm1 2:c2e0ac586386
157 bm3 2:c2e0ac586386
157 bm3 2:c2e0ac586386
158
158
159 check whether HG_PENDING makes pending changes only in relatd
159 check whether HG_PENDING makes pending changes only in relatd
160 repositories visible to an external hook.
160 repositories visible to an external hook.
161
161
162 In "hg share" case, another transaction can't run in other
162 In "hg share" case, another transaction can't run in other
163 repositories sharing same source repository, because starting
163 repositories sharing same source repository, because starting
164 transaction requires locking store of source repository.
164 transaction requires locking store of source repository.
165
165
166 Therefore, this test scenario ignores checking visibility of
166 Therefore, this test scenario ignores checking visibility of
167 .hg/bookmakrs.pending in repo2, which shares repo1 without bookmarks.
167 .hg/bookmakrs.pending in repo2, which shares repo1 without bookmarks.
168
168
169 $ cat > $TESTTMP/checkbookmarks.sh <<EOF
169 $ cat > $TESTTMP/checkbookmarks.sh <<EOF
170 > echo "@repo1"
170 > echo "@repo1"
171 > hg -R $TESTTMP/repo1 bookmarks
171 > hg -R "$TESTTMP/repo1" bookmarks
172 > echo "@repo2"
172 > echo "@repo2"
173 > hg -R $TESTTMP/repo2 bookmarks
173 > hg -R "$TESTTMP/repo2" bookmarks
174 > echo "@repo3"
174 > echo "@repo3"
175 > hg -R $TESTTMP/repo3 bookmarks
175 > hg -R "$TESTTMP/repo3" bookmarks
176 > exit 1 # to avoid adding new bookmark for subsequent tests
176 > exit 1 # to avoid adding new bookmark for subsequent tests
177 > EOF
177 > EOF
178
178
179 $ cd ../repo1
179 $ cd ../repo1
180 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkbookmarks.sh" -q book bmX
180 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkbookmarks.sh" -q book bmX
181 @repo1
181 @repo1
182 bm1 2:c2e0ac586386
182 bm1 2:c2e0ac586386
183 bm3 2:c2e0ac586386
183 bm3 2:c2e0ac586386
184 * bmX 2:c2e0ac586386
184 * bmX 2:c2e0ac586386
185 @repo2
185 @repo2
186 * bm2 3:0e6e70d1d5f1
186 * bm2 3:0e6e70d1d5f1
187 @repo3
187 @repo3
188 bm1 2:c2e0ac586386
188 bm1 2:c2e0ac586386
189 * bm3 2:c2e0ac586386
189 * bm3 2:c2e0ac586386
190 bmX 2:c2e0ac586386
190 bmX 2:c2e0ac586386
191 transaction abort!
191 transaction abort!
192 rollback completed
192 rollback completed
193 abort: pretxnclose hook exited with status 1
193 abort: pretxnclose hook exited with status 1
194 [255]
194 [255]
195 $ hg book bm1
195 $ hg book bm1
196
196
197 FYI, in contrast to above test, bmX is invisible in repo1 (= shared
197 FYI, in contrast to above test, bmX is invisible in repo1 (= shared
198 src), because (1) HG_PENDING refers only repo3 and (2)
198 src), because (1) HG_PENDING refers only repo3 and (2)
199 "bookmarks.pending" is written only into repo3.
199 "bookmarks.pending" is written only into repo3.
200
200
201 $ cd ../repo3
201 $ cd ../repo3
202 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkbookmarks.sh" -q book bmX
202 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkbookmarks.sh" -q book bmX
203 @repo1
203 @repo1
204 * bm1 2:c2e0ac586386
204 * bm1 2:c2e0ac586386
205 bm3 2:c2e0ac586386
205 bm3 2:c2e0ac586386
206 @repo2
206 @repo2
207 * bm2 3:0e6e70d1d5f1
207 * bm2 3:0e6e70d1d5f1
208 @repo3
208 @repo3
209 bm1 2:c2e0ac586386
209 bm1 2:c2e0ac586386
210 bm3 2:c2e0ac586386
210 bm3 2:c2e0ac586386
211 * bmX 2:c2e0ac586386
211 * bmX 2:c2e0ac586386
212 transaction abort!
212 transaction abort!
213 rollback completed
213 rollback completed
214 abort: pretxnclose hook exited with status 1
214 abort: pretxnclose hook exited with status 1
215 [255]
215 [255]
216 $ hg book bm3
216 $ hg book bm3
217
217
218 $ cd ../repo1
218 $ cd ../repo1
219
219
220 test that commits work
220 test that commits work
221
221
222 $ echo 'shared bookmarks' > a
222 $ echo 'shared bookmarks' > a
223 $ hg commit -m 'testing shared bookmarks'
223 $ hg commit -m 'testing shared bookmarks'
224 $ hg bookmarks
224 $ hg bookmarks
225 * bm1 3:b87954705719
225 * bm1 3:b87954705719
226 bm3 2:c2e0ac586386
226 bm3 2:c2e0ac586386
227 $ cd ../repo3
227 $ cd ../repo3
228 $ hg bookmarks
228 $ hg bookmarks
229 bm1 3:b87954705719
229 bm1 3:b87954705719
230 * bm3 2:c2e0ac586386
230 * bm3 2:c2e0ac586386
231 $ echo 'more shared bookmarks' > a
231 $ echo 'more shared bookmarks' > a
232 $ hg commit -m 'testing shared bookmarks'
232 $ hg commit -m 'testing shared bookmarks'
233 created new head
233 created new head
234 $ hg bookmarks
234 $ hg bookmarks
235 bm1 3:b87954705719
235 bm1 3:b87954705719
236 * bm3 4:62f4ded848e4
236 * bm3 4:62f4ded848e4
237 $ cd ../repo1
237 $ cd ../repo1
238 $ hg bookmarks
238 $ hg bookmarks
239 * bm1 3:b87954705719
239 * bm1 3:b87954705719
240 bm3 4:62f4ded848e4
240 bm3 4:62f4ded848e4
241 $ cd ..
241 $ cd ..
242
242
243 test pushing bookmarks works
243 test pushing bookmarks works
244
244
245 $ hg clone repo3 repo4
245 $ hg clone repo3 repo4
246 updating to branch default
246 updating to branch default
247 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
247 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
248 $ cd repo4
248 $ cd repo4
249 $ hg boo bm4
249 $ hg boo bm4
250 $ echo foo > b
250 $ echo foo > b
251 $ hg commit -m 'foo in b'
251 $ hg commit -m 'foo in b'
252 $ hg boo
252 $ hg boo
253 bm1 3:b87954705719
253 bm1 3:b87954705719
254 bm3 4:62f4ded848e4
254 bm3 4:62f4ded848e4
255 * bm4 5:92793bfc8cad
255 * bm4 5:92793bfc8cad
256 $ hg push -B bm4
256 $ hg push -B bm4
257 pushing to $TESTTMP/repo3 (glob)
257 pushing to $TESTTMP/repo3 (glob)
258 searching for changes
258 searching for changes
259 adding changesets
259 adding changesets
260 adding manifests
260 adding manifests
261 adding file changes
261 adding file changes
262 added 1 changesets with 1 changes to 1 files
262 added 1 changesets with 1 changes to 1 files
263 exporting bookmark bm4
263 exporting bookmark bm4
264 $ cd ../repo1
264 $ cd ../repo1
265 $ hg bookmarks
265 $ hg bookmarks
266 * bm1 3:b87954705719
266 * bm1 3:b87954705719
267 bm3 4:62f4ded848e4
267 bm3 4:62f4ded848e4
268 bm4 5:92793bfc8cad
268 bm4 5:92793bfc8cad
269 $ cd ../repo3
269 $ cd ../repo3
270 $ hg bookmarks
270 $ hg bookmarks
271 bm1 3:b87954705719
271 bm1 3:b87954705719
272 * bm3 4:62f4ded848e4
272 * bm3 4:62f4ded848e4
273 bm4 5:92793bfc8cad
273 bm4 5:92793bfc8cad
274 $ cd ..
274 $ cd ..
275
275
276 test behavior when sharing a shared repo
276 test behavior when sharing a shared repo
277
277
278 $ hg share -B repo3 repo5
278 $ hg share -B repo3 repo5
279 updating working directory
279 updating working directory
280 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
280 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 $ cd repo5
281 $ cd repo5
282 $ hg book
282 $ hg book
283 bm1 3:b87954705719
283 bm1 3:b87954705719
284 bm3 4:62f4ded848e4
284 bm3 4:62f4ded848e4
285 bm4 5:92793bfc8cad
285 bm4 5:92793bfc8cad
286 $ cd ..
286 $ cd ..
287
287
288 test what happens when an active bookmark is deleted
288 test what happens when an active bookmark is deleted
289
289
290 $ cd repo1
290 $ cd repo1
291 $ hg boo -d bm3
291 $ hg boo -d bm3
292 $ hg boo
292 $ hg boo
293 * bm1 3:b87954705719
293 * bm1 3:b87954705719
294 bm4 5:92793bfc8cad
294 bm4 5:92793bfc8cad
295 $ cd ../repo3
295 $ cd ../repo3
296 $ hg boo
296 $ hg boo
297 bm1 3:b87954705719
297 bm1 3:b87954705719
298 bm4 5:92793bfc8cad
298 bm4 5:92793bfc8cad
299 $ cd ..
299 $ cd ..
300
300
301 verify that bookmarks are not written on failed transaction
301 verify that bookmarks are not written on failed transaction
302
302
303 $ cat > failpullbookmarks.py << EOF
303 $ cat > failpullbookmarks.py << EOF
304 > """A small extension that makes bookmark pulls fail, for testing"""
304 > """A small extension that makes bookmark pulls fail, for testing"""
305 > from mercurial import extensions, exchange, error
305 > from mercurial import extensions, exchange, error
306 > def _pullbookmarks(orig, pullop):
306 > def _pullbookmarks(orig, pullop):
307 > orig(pullop)
307 > orig(pullop)
308 > raise error.HookAbort('forced failure by extension')
308 > raise error.HookAbort('forced failure by extension')
309 > def extsetup(ui):
309 > def extsetup(ui):
310 > extensions.wrapfunction(exchange, '_pullbookmarks', _pullbookmarks)
310 > extensions.wrapfunction(exchange, '_pullbookmarks', _pullbookmarks)
311 > EOF
311 > EOF
312 $ cd repo4
312 $ cd repo4
313 $ hg boo
313 $ hg boo
314 bm1 3:b87954705719
314 bm1 3:b87954705719
315 bm3 4:62f4ded848e4
315 bm3 4:62f4ded848e4
316 * bm4 5:92793bfc8cad
316 * bm4 5:92793bfc8cad
317 $ cd ../repo3
317 $ cd ../repo3
318 $ hg boo
318 $ hg boo
319 bm1 3:b87954705719
319 bm1 3:b87954705719
320 bm4 5:92793bfc8cad
320 bm4 5:92793bfc8cad
321 $ hg --config "extensions.failpullbookmarks=$TESTTMP/failpullbookmarks.py" pull $TESTTMP/repo4
321 $ hg --config "extensions.failpullbookmarks=$TESTTMP/failpullbookmarks.py" pull $TESTTMP/repo4
322 pulling from $TESTTMP/repo4 (glob)
322 pulling from $TESTTMP/repo4 (glob)
323 searching for changes
323 searching for changes
324 no changes found
324 no changes found
325 adding remote bookmark bm3
325 adding remote bookmark bm3
326 abort: forced failure by extension
326 abort: forced failure by extension
327 [255]
327 [255]
328 $ hg boo
328 $ hg boo
329 bm1 3:b87954705719
329 bm1 3:b87954705719
330 bm4 5:92793bfc8cad
330 bm4 5:92793bfc8cad
331 $ hg pull $TESTTMP/repo4
331 $ hg pull $TESTTMP/repo4
332 pulling from $TESTTMP/repo4 (glob)
332 pulling from $TESTTMP/repo4 (glob)
333 searching for changes
333 searching for changes
334 no changes found
334 no changes found
335 adding remote bookmark bm3
335 adding remote bookmark bm3
336 $ hg boo
336 $ hg boo
337 bm1 3:b87954705719
337 bm1 3:b87954705719
338 * bm3 4:62f4ded848e4
338 * bm3 4:62f4ded848e4
339 bm4 5:92793bfc8cad
339 bm4 5:92793bfc8cad
340 $ cd ..
340 $ cd ..
341
341
342 verify bookmark behavior after unshare
342 verify bookmark behavior after unshare
343
343
344 $ cd repo3
344 $ cd repo3
345 $ hg unshare
345 $ hg unshare
346 $ hg boo
346 $ hg boo
347 bm1 3:b87954705719
347 bm1 3:b87954705719
348 * bm3 4:62f4ded848e4
348 * bm3 4:62f4ded848e4
349 bm4 5:92793bfc8cad
349 bm4 5:92793bfc8cad
350 $ hg boo -d bm4
350 $ hg boo -d bm4
351 $ hg boo bm5
351 $ hg boo bm5
352 $ hg boo
352 $ hg boo
353 bm1 3:b87954705719
353 bm1 3:b87954705719
354 bm3 4:62f4ded848e4
354 bm3 4:62f4ded848e4
355 * bm5 4:62f4ded848e4
355 * bm5 4:62f4ded848e4
356 $ cd ../repo1
356 $ cd ../repo1
357 $ hg boo
357 $ hg boo
358 * bm1 3:b87954705719
358 * bm1 3:b87954705719
359 bm3 4:62f4ded848e4
359 bm3 4:62f4ded848e4
360 bm4 5:92793bfc8cad
360 bm4 5:92793bfc8cad
361 $ cd ..
361 $ cd ..
362
362
363 test shared clones using relative paths work
363 test shared clones using relative paths work
364
364
365 $ mkdir thisdir
365 $ mkdir thisdir
366 $ hg init thisdir/orig
366 $ hg init thisdir/orig
367 $ hg share -U thisdir/orig thisdir/abs
367 $ hg share -U thisdir/orig thisdir/abs
368 $ hg share -U --relative thisdir/abs thisdir/rel
368 $ hg share -U --relative thisdir/abs thisdir/rel
369 $ cat thisdir/rel/.hg/sharedpath
369 $ cat thisdir/rel/.hg/sharedpath
370 ../../orig/.hg (no-eol) (glob)
370 ../../orig/.hg (no-eol) (glob)
371 $ grep shared thisdir/*/.hg/requires
371 $ grep shared thisdir/*/.hg/requires
372 thisdir/abs/.hg/requires:shared
372 thisdir/abs/.hg/requires:shared
373 thisdir/rel/.hg/requires:shared
373 thisdir/rel/.hg/requires:shared
374 thisdir/rel/.hg/requires:relshared
374 thisdir/rel/.hg/requires:relshared
375
375
376 test that relative shared paths aren't relative to $PWD
376 test that relative shared paths aren't relative to $PWD
377
377
378 $ cd thisdir
378 $ cd thisdir
379 $ hg -R rel root
379 $ hg -R rel root
380 $TESTTMP/thisdir/rel (glob)
380 $TESTTMP/thisdir/rel (glob)
381 $ cd ..
381 $ cd ..
382
382
383 now test that relative paths really are relative, survive across
383 now test that relative paths really are relative, survive across
384 renames and changes of PWD
384 renames and changes of PWD
385
385
386 $ hg -R thisdir/abs root
386 $ hg -R thisdir/abs root
387 $TESTTMP/thisdir/abs (glob)
387 $TESTTMP/thisdir/abs (glob)
388 $ hg -R thisdir/rel root
388 $ hg -R thisdir/rel root
389 $TESTTMP/thisdir/rel (glob)
389 $TESTTMP/thisdir/rel (glob)
390 $ mv thisdir thatdir
390 $ mv thisdir thatdir
391 $ hg -R thatdir/abs root
391 $ hg -R thatdir/abs root
392 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/thisdir/orig/.hg! (glob)
392 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/thisdir/orig/.hg! (glob)
393 [255]
393 [255]
394 $ hg -R thatdir/rel root
394 $ hg -R thatdir/rel root
395 $TESTTMP/thatdir/rel (glob)
395 $TESTTMP/thatdir/rel (glob)
396
396
397 test unshare relshared repo
397 test unshare relshared repo
398
398
399 $ cd thatdir/rel
399 $ cd thatdir/rel
400 $ hg unshare
400 $ hg unshare
401 $ test -d .hg/store
401 $ test -d .hg/store
402 $ test -f .hg/sharedpath
402 $ test -f .hg/sharedpath
403 [1]
403 [1]
404 $ grep shared .hg/requires
404 $ grep shared .hg/requires
405 [1]
405 [1]
406 $ hg unshare
406 $ hg unshare
407 abort: this is not a shared repo
407 abort: this is not a shared repo
408 [255]
408 [255]
409 $ cd ../..
409 $ cd ../..
410
410
411 $ rm -r thatdir
411 $ rm -r thatdir
412
412
413 Explicitly kill daemons to let the test exit on Windows
413 Explicitly kill daemons to let the test exit on Windows
414
414
415 $ killdaemons.py
415 $ killdaemons.py
416
416
General Comments 0
You need to be logged in to leave comments. Login now