##// END OF EJS Templates
test: enable sparse-revlog for test-phases.t...
Boris Feld -
r40937:7bdc9753 default
parent child Browse files
Show More
@@ -1,953 +1,961 b''
1 TRANSITIONAL CONFIG
2 $ cat << EOF >> $HGRCPATH
3 > [format]
4 > sparse-revlog = yes
5 > EOF
6
1 7 $ cat > $TESTTMP/hook.sh << 'EOF'
2 8 > echo "test-hook-close-phase: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE"
3 9 > EOF
4 10
5 11 $ cat >> $HGRCPATH << EOF
6 12 > [extensions]
7 13 > phasereport=$TESTDIR/testlib/ext-phase-report.py
8 14 > [hooks]
9 15 > txnclose-phase.test = sh $TESTTMP/hook.sh
10 16 > EOF
11 17
12 18 $ hglog() { hg log --template "{rev} {phaseidx} {desc}\n" $*; }
13 19 $ mkcommit() {
14 20 > echo "$1" > "$1"
15 21 > hg add "$1"
16 22 > message="$1"
17 23 > shift
18 24 > hg ci -m "$message" $*
19 25 > }
20 26
21 27 $ hg init initialrepo
22 28 $ cd initialrepo
23 29
24 30 Cannot change null revision phase
25 31
26 32 $ hg phase --force --secret null
27 33 abort: cannot change null revision phase
28 34 [255]
29 35 $ hg phase null
30 36 -1: public
31 37
32 38 $ mkcommit A
33 39 test-debug-phase: new rev 0: x -> 1
34 40 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> draft
35 41
36 42 New commit are draft by default
37 43
38 44 $ hglog
39 45 0 1 A
40 46
41 47 Following commit are draft too
42 48
43 49 $ mkcommit B
44 50 test-debug-phase: new rev 1: x -> 1
45 51 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> draft
46 52
47 53 $ hglog
48 54 1 1 B
49 55 0 1 A
50 56
51 57 Draft commit are properly created over public one:
52 58
53 59 $ hg phase --public .
54 60 test-debug-phase: move rev 0: 1 -> 0
55 61 test-debug-phase: move rev 1: 1 -> 0
56 62 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: draft -> public
57 63 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: draft -> public
58 64 $ hg phase
59 65 1: public
60 66 $ hglog
61 67 1 0 B
62 68 0 0 A
63 69
64 70 $ mkcommit C
65 71 test-debug-phase: new rev 2: x -> 1
66 72 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> draft
67 73 $ mkcommit D
68 74 test-debug-phase: new rev 3: x -> 1
69 75 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> draft
70 76
71 77 $ hglog
72 78 3 1 D
73 79 2 1 C
74 80 1 0 B
75 81 0 0 A
76 82
77 83 Test creating changeset as secret
78 84
79 85 $ mkcommit E --config phases.new-commit='secret'
80 86 test-debug-phase: new rev 4: x -> 2
81 87 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: -> secret
82 88 $ hglog
83 89 4 2 E
84 90 3 1 D
85 91 2 1 C
86 92 1 0 B
87 93 0 0 A
88 94
89 95 Test the secret property is inherited
90 96
91 97 $ mkcommit H
92 98 test-debug-phase: new rev 5: x -> 2
93 99 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: -> secret
94 100 $ hglog
95 101 5 2 H
96 102 4 2 E
97 103 3 1 D
98 104 2 1 C
99 105 1 0 B
100 106 0 0 A
101 107
102 108 Even on merge
103 109
104 110 $ hg up -q 1
105 111 $ mkcommit "B'"
106 112 test-debug-phase: new rev 6: x -> 1
107 113 created new head
108 114 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> draft
109 115 $ hglog
110 116 6 1 B'
111 117 5 2 H
112 118 4 2 E
113 119 3 1 D
114 120 2 1 C
115 121 1 0 B
116 122 0 0 A
117 123 $ hg merge 4 # E
118 124 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 125 (branch merge, don't forget to commit)
120 126 $ hg phase
121 127 6: draft
122 128 4: secret
123 129 $ hg ci -m "merge B' and E"
124 130 test-debug-phase: new rev 7: x -> 2
125 131 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: -> secret
126 132
127 133 $ hglog
128 134 7 2 merge B' and E
129 135 6 1 B'
130 136 5 2 H
131 137 4 2 E
132 138 3 1 D
133 139 2 1 C
134 140 1 0 B
135 141 0 0 A
136 142
137 143 Test secret changeset are not pushed
138 144
139 145 $ hg init ../push-dest
140 146 $ cat > ../push-dest/.hg/hgrc << EOF
141 147 > [phases]
142 148 > publish=False
143 149 > EOF
144 150 $ hg outgoing ../push-dest --template='{rev} {phase} {desc|firstline}\n'
145 151 comparing with ../push-dest
146 152 searching for changes
147 153 0 public A
148 154 1 public B
149 155 2 draft C
150 156 3 draft D
151 157 6 draft B'
152 158 $ hg outgoing -r 'branch(default)' ../push-dest --template='{rev} {phase} {desc|firstline}\n'
153 159 comparing with ../push-dest
154 160 searching for changes
155 161 0 public A
156 162 1 public B
157 163 2 draft C
158 164 3 draft D
159 165 6 draft B'
160 166
161 167 $ hg push ../push-dest -f # force because we push multiple heads
162 168 pushing to ../push-dest
163 169 searching for changes
164 170 adding changesets
165 171 adding manifests
166 172 adding file changes
167 173 added 5 changesets with 5 changes to 5 files (+1 heads)
168 174 test-debug-phase: new rev 0: x -> 0
169 175 test-debug-phase: new rev 1: x -> 0
170 176 test-debug-phase: new rev 2: x -> 1
171 177 test-debug-phase: new rev 3: x -> 1
172 178 test-debug-phase: new rev 4: x -> 1
173 179 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
174 180 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
175 181 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> draft
176 182 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> draft
177 183 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> draft
178 184 $ hglog
179 185 7 2 merge B' and E
180 186 6 1 B'
181 187 5 2 H
182 188 4 2 E
183 189 3 1 D
184 190 2 1 C
185 191 1 0 B
186 192 0 0 A
187 193 $ cd ../push-dest
188 194 $ hglog
189 195 4 1 B'
190 196 3 1 D
191 197 2 1 C
192 198 1 0 B
193 199 0 0 A
194 200
195 201 (Issue3303)
196 202 Check that remote secret changeset are ignore when checking creation of remote heads
197 203
198 204 We add a secret head into the push destination. This secret head shadows a
199 205 visible shared between the initial repo and the push destination.
200 206
201 207 $ hg up -q 4 # B'
202 208 $ mkcommit Z --config phases.new-commit=secret
203 209 test-debug-phase: new rev 5: x -> 2
204 210 test-hook-close-phase: 2713879da13d6eea1ff22b442a5a87cb31a7ce6a: -> secret
205 211 $ hg phase .
206 212 5: secret
207 213
208 214 We now try to push a new public changeset that descend from the common public
209 215 head shadowed by the remote secret head.
210 216
211 217 $ cd ../initialrepo
212 218 $ hg up -q 6 #B'
213 219 $ mkcommit I
214 220 test-debug-phase: new rev 8: x -> 1
215 221 created new head
216 222 test-hook-close-phase: 6d6770faffce199f1fddd1cf87f6f026138cf061: -> draft
217 223 $ hg push ../push-dest
218 224 pushing to ../push-dest
219 225 searching for changes
220 226 adding changesets
221 227 adding manifests
222 228 adding file changes
223 229 added 1 changesets with 1 changes to 1 files (+1 heads)
224 230 test-debug-phase: new rev 6: x -> 1
225 231 test-hook-close-phase: 6d6770faffce199f1fddd1cf87f6f026138cf061: -> draft
226 232
227 233 :note: The "(+1 heads)" is wrong as we do not had any visible head
228 234
229 235 check that branch cache with "served" filter are properly computed and stored
230 236
231 237 $ ls ../push-dest/.hg/cache/branch2*
232 238 ../push-dest/.hg/cache/branch2-base
233 239 ../push-dest/.hg/cache/branch2-served
234 240 $ cat ../push-dest/.hg/cache/branch2-served
235 241 6d6770faffce199f1fddd1cf87f6f026138cf061 6 465891ffab3c47a3c23792f7dc84156e19a90722
236 242 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
237 243 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
238 244 $ hg heads -R ../push-dest --template '{rev}:{node} {phase}\n' #update visible cache too
239 245 6:6d6770faffce199f1fddd1cf87f6f026138cf061 draft
240 246 5:2713879da13d6eea1ff22b442a5a87cb31a7ce6a secret
241 247 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e draft
242 248 $ ls ../push-dest/.hg/cache/branch2*
243 249 ../push-dest/.hg/cache/branch2-base
244 250 ../push-dest/.hg/cache/branch2-served
245 251 ../push-dest/.hg/cache/branch2-visible
246 252 $ cat ../push-dest/.hg/cache/branch2-served
247 253 6d6770faffce199f1fddd1cf87f6f026138cf061 6 465891ffab3c47a3c23792f7dc84156e19a90722
248 254 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
249 255 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
250 256 $ cat ../push-dest/.hg/cache/branch2-visible
251 257 6d6770faffce199f1fddd1cf87f6f026138cf061 6
252 258 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
253 259 2713879da13d6eea1ff22b442a5a87cb31a7ce6a o default
254 260 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
255 261
256 262
257 263 Restore condition prior extra insertion.
258 264 $ hg -q --config extensions.mq= strip .
259 265 $ hg up -q 7
260 266 $ cd ..
261 267
262 268 Test secret changeset are not pull
263 269
264 270 $ hg init pull-dest
265 271 $ cd pull-dest
266 272 $ hg pull ../initialrepo
267 273 pulling from ../initialrepo
268 274 requesting all changes
269 275 adding changesets
270 276 adding manifests
271 277 adding file changes
272 278 added 5 changesets with 5 changes to 5 files (+1 heads)
273 279 new changesets 4a2df7238c3b:cf9fe039dfd6
274 280 test-debug-phase: new rev 0: x -> 0
275 281 test-debug-phase: new rev 1: x -> 0
276 282 test-debug-phase: new rev 2: x -> 0
277 283 test-debug-phase: new rev 3: x -> 0
278 284 test-debug-phase: new rev 4: x -> 0
279 285 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
280 286 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
281 287 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> public
282 288 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> public
283 289 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> public
284 290 (run 'hg heads' to see heads, 'hg merge' to merge)
285 291 $ hglog
286 292 4 0 B'
287 293 3 0 D
288 294 2 0 C
289 295 1 0 B
290 296 0 0 A
291 297 $ cd ..
292 298
293 299 But secret can still be bundled explicitly
294 300
295 301 $ cd initialrepo
296 302 $ hg bundle --base '4^' -r 'children(4)' ../secret-bundle.hg
297 303 4 changesets found
298 304 $ cd ..
299 305
300 306 Test secret changeset are not cloned
301 307 (during local clone)
302 308
303 309 $ hg clone -qU initialrepo clone-dest
304 310 test-debug-phase: new rev 0: x -> 0
305 311 test-debug-phase: new rev 1: x -> 0
306 312 test-debug-phase: new rev 2: x -> 0
307 313 test-debug-phase: new rev 3: x -> 0
308 314 test-debug-phase: new rev 4: x -> 0
309 315 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
310 316 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
311 317 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> public
312 318 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> public
313 319 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> public
314 320 $ hglog -R clone-dest
315 321 4 0 B'
316 322 3 0 D
317 323 2 0 C
318 324 1 0 B
319 325 0 0 A
320 326
321 327 Test summary
322 328
323 329 $ hg summary -R clone-dest --verbose
324 330 parent: -1:000000000000 (no revision checked out)
325 331 branch: default
326 332 commit: (clean)
327 333 update: 5 new changesets (update)
328 334 $ hg summary -R initialrepo
329 335 parent: 7:17a481b3bccb tip
330 336 merge B' and E
331 337 branch: default
332 338 commit: (clean) (secret)
333 339 update: 1 new changesets, 2 branch heads (merge)
334 340 phases: 3 draft, 3 secret
335 341 $ hg summary -R initialrepo --quiet
336 342 parent: 7:17a481b3bccb tip
337 343 update: 1 new changesets, 2 branch heads (merge)
338 344
339 345 Test revset
340 346
341 347 $ cd initialrepo
342 348 $ hglog -r 'public()'
343 349 0 0 A
344 350 1 0 B
345 351 $ hglog -r 'draft()'
346 352 2 1 C
347 353 3 1 D
348 354 6 1 B'
349 355 $ hglog -r 'secret()'
350 356 4 2 E
351 357 5 2 H
352 358 7 2 merge B' and E
353 359
354 360 test that phase are displayed in log at debug level
355 361
356 362 $ hg log --debug
357 363 changeset: 7:17a481b3bccb796c0521ae97903d81c52bfee4af
358 364 tag: tip
359 365 phase: secret
360 366 parent: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
361 367 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
362 368 manifest: 7:5e724ffacba267b2ab726c91fc8b650710deaaa8
363 369 user: test
364 370 date: Thu Jan 01 00:00:00 1970 +0000
365 371 files+: C D E
366 372 extra: branch=default
367 373 description:
368 374 merge B' and E
369 375
370 376
371 377 changeset: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
372 378 phase: draft
373 379 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
374 380 parent: -1:0000000000000000000000000000000000000000
375 381 manifest: 6:ab8bfef2392903058bf4ebb9e7746e8d7026b27a
376 382 user: test
377 383 date: Thu Jan 01 00:00:00 1970 +0000
378 384 files+: B'
379 385 extra: branch=default
380 386 description:
381 387 B'
382 388
383 389
384 390 changeset: 5:a030c6be5127abc010fcbff1851536552e6951a8
385 391 phase: secret
386 392 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
387 393 parent: -1:0000000000000000000000000000000000000000
388 394 manifest: 5:5c710aa854874fe3d5fa7192e77bdb314cc08b5a
389 395 user: test
390 396 date: Thu Jan 01 00:00:00 1970 +0000
391 397 files+: H
392 398 extra: branch=default
393 399 description:
394 400 H
395 401
396 402
397 403 changeset: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
398 404 phase: secret
399 405 parent: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
400 406 parent: -1:0000000000000000000000000000000000000000
401 407 manifest: 4:7173fd1c27119750b959e3a0f47ed78abe75d6dc
402 408 user: test
403 409 date: Thu Jan 01 00:00:00 1970 +0000
404 410 files+: E
405 411 extra: branch=default
406 412 description:
407 413 E
408 414
409 415
410 416 changeset: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
411 417 phase: draft
412 418 parent: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
413 419 parent: -1:0000000000000000000000000000000000000000
414 420 manifest: 3:6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c
415 421 user: test
416 422 date: Thu Jan 01 00:00:00 1970 +0000
417 423 files+: D
418 424 extra: branch=default
419 425 description:
420 426 D
421 427
422 428
423 429 changeset: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
424 430 phase: draft
425 431 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
426 432 parent: -1:0000000000000000000000000000000000000000
427 433 manifest: 2:66a5a01817fdf5239c273802b5b7618d051c89e4
428 434 user: test
429 435 date: Thu Jan 01 00:00:00 1970 +0000
430 436 files+: C
431 437 extra: branch=default
432 438 description:
433 439 C
434 440
435 441
436 442 changeset: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
437 443 phase: public
438 444 parent: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
439 445 parent: -1:0000000000000000000000000000000000000000
440 446 manifest: 1:cb5cbbc1bfbf24cc34b9e8c16914e9caa2d2a7fd
441 447 user: test
442 448 date: Thu Jan 01 00:00:00 1970 +0000
443 449 files+: B
444 450 extra: branch=default
445 451 description:
446 452 B
447 453
448 454
449 455 changeset: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
450 456 phase: public
451 457 parent: -1:0000000000000000000000000000000000000000
452 458 parent: -1:0000000000000000000000000000000000000000
453 459 manifest: 0:007d8c9d88841325f5c6b06371b35b4e8a2b1a83
454 460 user: test
455 461 date: Thu Jan 01 00:00:00 1970 +0000
456 462 files+: A
457 463 extra: branch=default
458 464 description:
459 465 A
460 466
461 467
462 468
463 469
464 470 (Issue3707)
465 471 test invalid phase name
466 472
467 473 $ mkcommit I --config phases.new-commit='babar'
468 474 transaction abort!
469 475 rollback completed
470 476 abort: phases.new-commit: not a valid phase name ('babar')
471 477 [255]
472 478 Test phase command
473 479 ===================
474 480
475 481 initial picture
476 482
477 483 $ hg log -G --template "{rev} {phase} {desc}\n"
478 484 @ 7 secret merge B' and E
479 485 |\
480 486 | o 6 draft B'
481 487 | |
482 488 +---o 5 secret H
483 489 | |
484 490 o | 4 secret E
485 491 | |
486 492 o | 3 draft D
487 493 | |
488 494 o | 2 draft C
489 495 |/
490 496 o 1 public B
491 497 |
492 498 o 0 public A
493 499
494 500
495 501 display changesets phase
496 502
497 503 (mixing -r and plain rev specification)
498 504
499 505 $ hg phase 1::4 -r 7
500 506 1: public
501 507 2: draft
502 508 3: draft
503 509 4: secret
504 510 7: secret
505 511
506 512
507 513 move changeset forward
508 514
509 515 (with -r option)
510 516
511 517 $ hg phase --public -r 2
512 518 test-debug-phase: move rev 2: 1 -> 0
513 519 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: draft -> public
514 520 $ hg log -G --template "{rev} {phase} {desc}\n"
515 521 @ 7 secret merge B' and E
516 522 |\
517 523 | o 6 draft B'
518 524 | |
519 525 +---o 5 secret H
520 526 | |
521 527 o | 4 secret E
522 528 | |
523 529 o | 3 draft D
524 530 | |
525 531 o | 2 public C
526 532 |/
527 533 o 1 public B
528 534 |
529 535 o 0 public A
530 536
531 537
532 538 move changeset backward
533 539
534 540 (without -r option)
535 541
536 542 $ hg phase --draft --force 2
537 543 test-debug-phase: move rev 2: 0 -> 1
538 544 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: public -> draft
539 545 $ hg log -G --template "{rev} {phase} {desc}\n"
540 546 @ 7 secret merge B' and E
541 547 |\
542 548 | o 6 draft B'
543 549 | |
544 550 +---o 5 secret H
545 551 | |
546 552 o | 4 secret E
547 553 | |
548 554 o | 3 draft D
549 555 | |
550 556 o | 2 draft C
551 557 |/
552 558 o 1 public B
553 559 |
554 560 o 0 public A
555 561
556 562
557 563 move changeset forward and backward
558 564
559 565 $ hg phase --draft --force 1::4
560 566 test-debug-phase: move rev 1: 0 -> 1
561 567 test-debug-phase: move rev 4: 2 -> 1
562 568 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: public -> draft
563 569 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: secret -> draft
564 570 $ hg log -G --template "{rev} {phase} {desc}\n"
565 571 @ 7 secret merge B' and E
566 572 |\
567 573 | o 6 draft B'
568 574 | |
569 575 +---o 5 secret H
570 576 | |
571 577 o | 4 draft E
572 578 | |
573 579 o | 3 draft D
574 580 | |
575 581 o | 2 draft C
576 582 |/
577 583 o 1 draft B
578 584 |
579 585 o 0 public A
580 586
581 587 test partial failure
582 588
583 589 $ hg phase --public 7
584 590 test-debug-phase: move rev 1: 1 -> 0
585 591 test-debug-phase: move rev 2: 1 -> 0
586 592 test-debug-phase: move rev 3: 1 -> 0
587 593 test-debug-phase: move rev 4: 1 -> 0
588 594 test-debug-phase: move rev 6: 1 -> 0
589 595 test-debug-phase: move rev 7: 2 -> 0
590 596 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: draft -> public
591 597 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: draft -> public
592 598 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: draft -> public
593 599 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: draft -> public
594 600 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: draft -> public
595 601 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: secret -> public
596 602 $ hg phase --draft '5 or 7'
597 603 test-debug-phase: move rev 5: 2 -> 1
598 604 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: secret -> draft
599 605 cannot move 1 changesets to a higher phase, use --force
600 606 phase changed for 1 changesets
601 607 [1]
602 608 $ hg log -G --template "{rev} {phase} {desc}\n"
603 609 @ 7 public merge B' and E
604 610 |\
605 611 | o 6 public B'
606 612 | |
607 613 +---o 5 draft H
608 614 | |
609 615 o | 4 public E
610 616 | |
611 617 o | 3 public D
612 618 | |
613 619 o | 2 public C
614 620 |/
615 621 o 1 public B
616 622 |
617 623 o 0 public A
618 624
619 625
620 626 test complete failure
621 627
622 628 $ hg phase --draft 7
623 629 cannot move 1 changesets to a higher phase, use --force
624 630 no phases changed
625 631 [1]
626 632
627 633 $ cd ..
628 634
629 635 test hidden changeset are not cloned as public (issue3935)
630 636
631 637 $ cd initialrepo
632 638
633 639 (enabling evolution)
634 640 $ cat >> $HGRCPATH << EOF
635 641 > [experimental]
636 642 > evolution.createmarkers=True
637 643 > EOF
638 644
639 645 (making a changeset hidden; H in that case)
640 646 $ hg debugobsolete `hg id --debug -r 5`
641 647 obsoleted 1 changesets
642 648
643 649 $ cd ..
644 650 $ hg clone initialrepo clonewithobs
645 651 requesting all changes
646 652 adding changesets
647 653 adding manifests
648 654 adding file changes
649 655 added 7 changesets with 6 changes to 6 files
650 656 new changesets 4a2df7238c3b:17a481b3bccb
651 657 test-debug-phase: new rev 0: x -> 0
652 658 test-debug-phase: new rev 1: x -> 0
653 659 test-debug-phase: new rev 2: x -> 0
654 660 test-debug-phase: new rev 3: x -> 0
655 661 test-debug-phase: new rev 4: x -> 0
656 662 test-debug-phase: new rev 5: x -> 0
657 663 test-debug-phase: new rev 6: x -> 0
658 664 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
659 665 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
660 666 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> public
661 667 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> public
662 668 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: -> public
663 669 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> public
664 670 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: -> public
665 671 updating to branch default
666 672 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
667 673 $ cd clonewithobs
668 674 $ hg log -G --template "{rev} {phase} {desc}\n"
669 675 @ 6 public merge B' and E
670 676 |\
671 677 | o 5 public B'
672 678 | |
673 679 o | 4 public E
674 680 | |
675 681 o | 3 public D
676 682 | |
677 683 o | 2 public C
678 684 |/
679 685 o 1 public B
680 686 |
681 687 o 0 public A
682 688
683 689
684 690 test verify repo containing hidden changesets, which should not abort just
685 691 because repo.cancopy() is False
686 692
687 693 $ cd ../initialrepo
688 694 $ hg verify
689 695 checking changesets
690 696 checking manifests
691 697 crosschecking files in changesets and manifests
692 698 checking files
693 699 checked 8 changesets with 7 changes to 7 files
694 700
695 701 $ cd ..
696 702
697 703 check whether HG_PENDING makes pending changes only in related
698 704 repositories visible to an external hook.
699 705
700 706 (emulate a transaction running concurrently by copied
701 707 .hg/phaseroots.pending in subsequent test)
702 708
703 709 $ cat > $TESTTMP/savepending.sh <<EOF
704 710 > cp .hg/store/phaseroots.pending .hg/store/phaseroots.pending.saved
705 711 > exit 1 # to avoid changing phase for subsequent tests
706 712 > EOF
707 713 $ cd push-dest
708 714 $ hg phase 6
709 715 6: draft
710 716 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" phase -f -s 6
711 717 transaction abort!
712 718 rollback completed
713 719 abort: pretxnclose hook exited with status 1
714 720 [255]
715 721 $ cp .hg/store/phaseroots.pending.saved .hg/store/phaseroots.pending
716 722
717 723 (check (in)visibility of phaseroot while transaction running in repo)
718 724
719 725 $ cat > $TESTTMP/checkpending.sh <<EOF
720 726 > echo '@initialrepo'
721 727 > hg -R "$TESTTMP/initialrepo" phase 7
722 728 > echo '@push-dest'
723 729 > hg -R "$TESTTMP/push-dest" phase 6
724 730 > exit 1 # to avoid changing phase for subsequent tests
725 731 > EOF
726 732 $ cd ../initialrepo
727 733 $ hg phase 7
728 734 7: public
729 735 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" phase -f -s 7
730 736 @initialrepo
731 737 7: secret
732 738 @push-dest
733 739 6: draft
734 740 transaction abort!
735 741 rollback completed
736 742 abort: pretxnclose hook exited with status 1
737 743 [255]
738 744
739 745 Check that pretxnclose-phase hook can control phase movement
740 746
741 747 $ hg phase --force b3325c91a4d9 --secret
742 748 test-debug-phase: move rev 3: 0 -> 2
743 749 test-debug-phase: move rev 4: 0 -> 2
744 750 test-debug-phase: move rev 5: 1 -> 2
745 751 test-debug-phase: move rev 7: 0 -> 2
746 752 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: public -> secret
747 753 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: public -> secret
748 754 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: draft -> secret
749 755 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: public -> secret
750 756 $ hg log -G -T phases
751 757 @ changeset: 7:17a481b3bccb
752 758 |\ tag: tip
753 759 | | phase: secret
754 760 | | parent: 6:cf9fe039dfd6
755 761 | | parent: 4:a603bfb5a83e
756 762 | | user: test
757 763 | | date: Thu Jan 01 00:00:00 1970 +0000
758 764 | | summary: merge B' and E
759 765 | |
760 766 | o changeset: 6:cf9fe039dfd6
761 767 | | phase: public
762 768 | | parent: 1:27547f69f254
763 769 | | user: test
764 770 | | date: Thu Jan 01 00:00:00 1970 +0000
765 771 | | summary: B'
766 772 | |
767 773 o | changeset: 4:a603bfb5a83e
768 774 | | phase: secret
769 775 | | user: test
770 776 | | date: Thu Jan 01 00:00:00 1970 +0000
771 777 | | summary: E
772 778 | |
773 779 o | changeset: 3:b3325c91a4d9
774 780 | | phase: secret
775 781 | | user: test
776 782 | | date: Thu Jan 01 00:00:00 1970 +0000
777 783 | | summary: D
778 784 | |
779 785 o | changeset: 2:f838bfaca5c7
780 786 |/ phase: public
781 787 | user: test
782 788 | date: Thu Jan 01 00:00:00 1970 +0000
783 789 | summary: C
784 790 |
785 791 o changeset: 1:27547f69f254
786 792 | phase: public
787 793 | user: test
788 794 | date: Thu Jan 01 00:00:00 1970 +0000
789 795 | summary: B
790 796 |
791 797 o changeset: 0:4a2df7238c3b
792 798 phase: public
793 799 user: test
794 800 date: Thu Jan 01 00:00:00 1970 +0000
795 801 summary: A
796 802
797 803
798 804 Install a hook that prevent b3325c91a4d9 to become public
799 805
800 806 $ cat >> .hg/hgrc << EOF
801 807 > [hooks]
802 808 > pretxnclose-phase.nopublish_D = sh -c "(echo \$HG_NODE| grep -v b3325c91a4d9>/dev/null) || [ 'public' != \$HG_PHASE ]"
803 809 > EOF
804 810
805 811 Try various actions. only the draft move should succeed
806 812
807 813 $ hg phase --public b3325c91a4d9
808 814 transaction abort!
809 815 rollback completed
810 816 abort: pretxnclose-phase.nopublish_D hook exited with status 1
811 817 [255]
812 818 $ hg phase --public a603bfb5a83e
813 819 transaction abort!
814 820 rollback completed
815 821 abort: pretxnclose-phase.nopublish_D hook exited with status 1
816 822 [255]
817 823 $ hg phase --draft 17a481b3bccb
818 824 test-debug-phase: move rev 3: 2 -> 1
819 825 test-debug-phase: move rev 4: 2 -> 1
820 826 test-debug-phase: move rev 7: 2 -> 1
821 827 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: secret -> draft
822 828 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: secret -> draft
823 829 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: secret -> draft
824 830 $ hg phase --public 17a481b3bccb
825 831 transaction abort!
826 832 rollback completed
827 833 abort: pretxnclose-phase.nopublish_D hook exited with status 1
828 834 [255]
829 835
830 836 $ cd ..
831 837
832 838 Test for the "internal" phase
833 839 =============================
834 840
835 841 Check we deny its usage on older repository
836 842
837 843 $ hg init no-internal-phase --config format.internal-phase=no
838 844 $ cd no-internal-phase
839 845 $ cat .hg/requires
840 846 dotencode
841 847 fncache
842 848 generaldelta
843 849 revlogv1
850 sparserevlog
844 851 store
845 852 $ echo X > X
846 853 $ hg add X
847 854 $ hg status
848 855 A X
849 856 $ hg --config "phases.new-commit=internal" commit -m "my test internal commit" 2>&1 | grep ProgrammingError
850 857 ** ProgrammingError: this repository does not support the internal phase
851 858 raise error.ProgrammingError(msg)
852 859 mercurial.error.ProgrammingError: this repository does not support the internal phase
853 860 $ hg --config "phases.new-commit=archived" commit -m "my test archived commit" 2>&1 | grep ProgrammingError
854 861 ** ProgrammingError: this repository does not support the archived phase
855 862 raise error.ProgrammingError(msg)
856 863 mercurial.error.ProgrammingError: this repository does not support the archived phase
857 864
858 865 $ cd ..
859 866
860 867 Check it works fine with repository that supports it.
861 868
862 869 $ hg init internal-phase --config format.internal-phase=yes
863 870 $ cd internal-phase
864 871 $ cat .hg/requires
865 872 dotencode
866 873 fncache
867 874 generaldelta
868 875 internal-phase
869 876 revlogv1
877 sparserevlog
870 878 store
871 879 $ mkcommit A
872 880 test-debug-phase: new rev 0: x -> 1
873 881 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> draft
874 882
875 883 Commit an internal changesets
876 884
877 885 $ echo B > B
878 886 $ hg add B
879 887 $ hg status
880 888 A B
881 889 $ hg --config "phases.new-commit=internal" commit -m "my test internal commit"
882 890 test-debug-phase: new rev 1: x -> 96
883 891 test-hook-close-phase: c01c42dffc7f81223397e99652a0703f83e1c5ea: -> internal
884 892
885 893 The changeset is a working parent descendant.
886 894 Per the usual visibility rules, it is made visible.
887 895
888 896 $ hg log -G -l 3
889 897 @ changeset: 1:c01c42dffc7f
890 898 | tag: tip
891 899 | user: test
892 900 | date: Thu Jan 01 00:00:00 1970 +0000
893 901 | summary: my test internal commit
894 902 |
895 903 o changeset: 0:4a2df7238c3b
896 904 user: test
897 905 date: Thu Jan 01 00:00:00 1970 +0000
898 906 summary: A
899 907
900 908
901 909 Commit is hidden as expected
902 910
903 911 $ hg up 0
904 912 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
905 913 $ hg log -G
906 914 @ changeset: 0:4a2df7238c3b
907 915 tag: tip
908 916 user: test
909 917 date: Thu Jan 01 00:00:00 1970 +0000
910 918 summary: A
911 919
912 920
913 921 Test for archived phase
914 922 -----------------------
915 923
916 924 Commit an archived changesets
917 925
918 926 $ echo B > B
919 927 $ hg add B
920 928 $ hg status
921 929 A B
922 930 $ hg --config "phases.new-commit=archived" commit -m "my test archived commit"
923 931 test-debug-phase: new rev 2: x -> 32
924 932 test-hook-close-phase: 8df5997c3361518f733d1ae67cd3adb9b0eaf125: -> archived
925 933
926 934 The changeset is a working parent descendant.
927 935 Per the usual visibility rules, it is made visible.
928 936
929 937 $ hg log -G -l 3
930 938 @ changeset: 2:8df5997c3361
931 939 | tag: tip
932 940 | parent: 0:4a2df7238c3b
933 941 | user: test
934 942 | date: Thu Jan 01 00:00:00 1970 +0000
935 943 | summary: my test archived commit
936 944 |
937 945 o changeset: 0:4a2df7238c3b
938 946 user: test
939 947 date: Thu Jan 01 00:00:00 1970 +0000
940 948 summary: A
941 949
942 950
943 951 Commit is hidden as expected
944 952
945 953 $ hg up 0
946 954 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
947 955 $ hg log -G
948 956 @ changeset: 0:4a2df7238c3b
949 957 tag: tip
950 958 user: test
951 959 date: Thu Jan 01 00:00:00 1970 +0000
952 960 summary: A
953 961
General Comments 0
You need to be logged in to leave comments. Login now