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