##// END OF EJS Templates
phases: pass phase names to hooks instead of internal values
Kevin Bullock -
r34877:eb1b964b default
parent child Browse files
Show More
@@ -660,7 +660,7 b' def preparehookargs(node, old, new):'
660 660 if old is None:
661 661 old = ''
662 662 else:
663 old = '%s' % old
663 old = phasenames[old]
664 664 return {'node': node,
665 665 'oldphase': old,
666 'phase': '%s' % new}
666 'phase': phasenames[new]}
@@ -28,7 +28,7 b' Cannot change null revision phase'
28 28
29 29 $ mkcommit A
30 30 test-debug-phase: new rev 0: x -> 1
31 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> 1
31 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> draft
32 32
33 33 New commit are draft by default
34 34
@@ -39,7 +39,7 b' Following commit are draft too'
39 39
40 40 $ mkcommit B
41 41 test-debug-phase: new rev 1: x -> 1
42 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> 1
42 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> draft
43 43
44 44 $ hglog
45 45 1 1 B
@@ -50,8 +50,8 b' Draft commit are properly created over p'
50 50 $ hg phase --public .
51 51 test-debug-phase: move rev 0: 1 -> 0
52 52 test-debug-phase: move rev 1: 1 -> 0
53 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: 1 -> 0
54 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: 1 -> 0
53 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: draft -> public
54 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: draft -> public
55 55 $ hg phase
56 56 1: public
57 57 $ hglog
@@ -60,10 +60,10 b' Draft commit are properly created over p'
60 60
61 61 $ mkcommit C
62 62 test-debug-phase: new rev 2: x -> 1
63 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> 1
63 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> draft
64 64 $ mkcommit D
65 65 test-debug-phase: new rev 3: x -> 1
66 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> 1
66 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> draft
67 67
68 68 $ hglog
69 69 3 1 D
@@ -75,7 +75,7 b' Test creating changeset as secret'
75 75
76 76 $ mkcommit E --config phases.new-commit='secret'
77 77 test-debug-phase: new rev 4: x -> 2
78 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: -> 2
78 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: -> secret
79 79 $ hglog
80 80 4 2 E
81 81 3 1 D
@@ -87,7 +87,7 b' Test the secret property is inherited'
87 87
88 88 $ mkcommit H
89 89 test-debug-phase: new rev 5: x -> 2
90 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: -> 2
90 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: -> secret
91 91 $ hglog
92 92 5 2 H
93 93 4 2 E
@@ -102,7 +102,7 b' Even on merge'
102 102 $ mkcommit "B'"
103 103 test-debug-phase: new rev 6: x -> 1
104 104 created new head
105 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> 1
105 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> draft
106 106 $ hglog
107 107 6 1 B'
108 108 5 2 H
@@ -119,7 +119,7 b' Even on merge'
119 119 4: secret
120 120 $ hg ci -m "merge B' and E"
121 121 test-debug-phase: new rev 7: x -> 2
122 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: -> 2
122 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: -> secret
123 123
124 124 $ hglog
125 125 7 2 merge B' and E
@@ -167,11 +167,11 b' Test secret changeset are not pushed'
167 167 test-debug-phase: new rev 2: x -> 1
168 168 test-debug-phase: new rev 3: x -> 1
169 169 test-debug-phase: new rev 4: x -> 1
170 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> 0
171 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> 0
172 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> 1
173 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> 1
174 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> 1
170 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
171 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
172 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> draft
173 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> draft
174 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> draft
175 175 $ hglog
176 176 7 2 merge B' and E
177 177 6 1 B'
@@ -198,7 +198,7 b' visible shared between the initial repo '
198 198 $ hg up -q 4 # B'
199 199 $ mkcommit Z --config phases.new-commit=secret
200 200 test-debug-phase: new rev 5: x -> 2
201 test-hook-close-phase: 2713879da13d6eea1ff22b442a5a87cb31a7ce6a: -> 2
201 test-hook-close-phase: 2713879da13d6eea1ff22b442a5a87cb31a7ce6a: -> secret
202 202 $ hg phase .
203 203 5: secret
204 204
@@ -210,7 +210,7 b' head shadowed by the remote secret head.'
210 210 $ mkcommit I
211 211 test-debug-phase: new rev 8: x -> 1
212 212 created new head
213 test-hook-close-phase: 6d6770faffce199f1fddd1cf87f6f026138cf061: -> 1
213 test-hook-close-phase: 6d6770faffce199f1fddd1cf87f6f026138cf061: -> draft
214 214 $ hg push ../push-dest
215 215 pushing to ../push-dest
216 216 searching for changes
@@ -219,7 +219,7 b' head shadowed by the remote secret head.'
219 219 adding file changes
220 220 added 1 changesets with 1 changes to 1 files (+1 heads)
221 221 test-debug-phase: new rev 6: x -> 1
222 test-hook-close-phase: 6d6770faffce199f1fddd1cf87f6f026138cf061: -> 1
222 test-hook-close-phase: 6d6770faffce199f1fddd1cf87f6f026138cf061: -> draft
223 223
224 224 :note: The "(+1 heads)" is wrong as we do not had any visible head
225 225
@@ -273,11 +273,11 b' Test secret changeset are not pull'
273 273 test-debug-phase: new rev 2: x -> 0
274 274 test-debug-phase: new rev 3: x -> 0
275 275 test-debug-phase: new rev 4: x -> 0
276 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> 0
277 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> 0
278 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> 0
279 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> 0
280 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> 0
276 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
277 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
278 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> public
279 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> public
280 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> public
281 281 (run 'hg heads' to see heads, 'hg merge' to merge)
282 282 $ hglog
283 283 4 0 B'
@@ -303,11 +303,11 b' Test secret changeset are not cloned'
303 303 test-debug-phase: new rev 2: x -> 0
304 304 test-debug-phase: new rev 3: x -> 0
305 305 test-debug-phase: new rev 4: x -> 0
306 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> 0
307 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> 0
308 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> 0
309 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> 0
310 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> 0
306 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
307 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
308 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> public
309 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> public
310 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> public
311 311 $ hglog -R clone-dest
312 312 4 0 B'
313 313 3 0 D
@@ -507,7 +507,7 b' move changeset forward'
507 507
508 508 $ hg phase --public -r 2
509 509 test-debug-phase: move rev 2: 1 -> 0
510 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: 1 -> 0
510 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: draft -> public
511 511 $ hg log -G --template "{rev} {phase} {desc}\n"
512 512 @ 7 secret merge B' and E
513 513 |\
@@ -532,7 +532,7 b' move changeset backward'
532 532
533 533 $ hg phase --draft --force 2
534 534 test-debug-phase: move rev 2: 0 -> 1
535 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: 0 -> 1
535 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: public -> draft
536 536 $ hg log -G --template "{rev} {phase} {desc}\n"
537 537 @ 7 secret merge B' and E
538 538 |\
@@ -556,8 +556,8 b' move changeset forward and backward'
556 556 $ hg phase --draft --force 1::4
557 557 test-debug-phase: move rev 1: 0 -> 1
558 558 test-debug-phase: move rev 4: 2 -> 1
559 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: 0 -> 1
560 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: 2 -> 1
559 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: public -> draft
560 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: secret -> draft
561 561 $ hg log -G --template "{rev} {phase} {desc}\n"
562 562 @ 7 secret merge B' and E
563 563 |\
@@ -584,15 +584,15 b' test partial failure'
584 584 test-debug-phase: move rev 4: 1 -> 0
585 585 test-debug-phase: move rev 6: 1 -> 0
586 586 test-debug-phase: move rev 7: 2 -> 0
587 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: 1 -> 0
588 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: 1 -> 0
589 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: 1 -> 0
590 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: 1 -> 0
591 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: 1 -> 0
592 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: 2 -> 0
587 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: draft -> public
588 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: draft -> public
589 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: draft -> public
590 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: draft -> public
591 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: draft -> public
592 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: secret -> public
593 593 $ hg phase --draft '5 or 7'
594 594 test-debug-phase: move rev 5: 2 -> 1
595 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: 2 -> 1
595 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: secret -> draft
596 596 cannot move 1 changesets to a higher phase, use --force
597 597 phase changed for 1 changesets
598 598 [1]
@@ -652,13 +652,13 b' test hidden changeset are not cloned as '
652 652 test-debug-phase: new rev 4: x -> 0
653 653 test-debug-phase: new rev 5: x -> 0
654 654 test-debug-phase: new rev 6: x -> 0
655 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> 0
656 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> 0
657 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> 0
658 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> 0
659 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: -> 0
660 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> 0
661 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: -> 0
655 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
656 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
657 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> public
658 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> public
659 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: -> public
660 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> public
661 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: -> public
662 662 updating to branch default
663 663 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
664 664 $ cd clonewithobs
@@ -740,10 +740,10 b' Check that pretxnclose-phase hook can co'
740 740 test-debug-phase: move rev 4: 0 -> 2
741 741 test-debug-phase: move rev 5: 1 -> 2
742 742 test-debug-phase: move rev 7: 0 -> 2
743 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: 0 -> 2
744 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: 0 -> 2
745 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: 1 -> 2
746 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: 0 -> 2
743 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: public -> secret
744 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: public -> secret
745 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: draft -> secret
746 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: public -> secret
747 747 $ hg log -G -T phases
748 748 @ changeset: 7:17a481b3bccb
749 749 |\ tag: tip
@@ -796,7 +796,7 b' Install a hook that prevent b3325c91a4d9'
796 796
797 797 $ cat >> .hg/hgrc << EOF
798 798 > [hooks]
799 > pretxnclose-phase.nopublish_D = (echo \$HG_NODE| grep -v b3325c91a4d9>/dev/null) || [ 0 -lt \$HG_PHASE ]
799 > pretxnclose-phase.nopublish_D = (echo \$HG_NODE| grep -v b3325c91a4d9>/dev/null) || [ 'public' != \$HG_PHASE ]
800 800 > EOF
801 801
802 802 Try various actions. only the draft move should succeed
@@ -815,9 +815,9 b' Try various actions. only the draft move'
815 815 test-debug-phase: move rev 3: 2 -> 1
816 816 test-debug-phase: move rev 4: 2 -> 1
817 817 test-debug-phase: move rev 7: 2 -> 1
818 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: 2 -> 1
819 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: 2 -> 1
820 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: 2 -> 1
818 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: secret -> draft
819 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: secret -> draft
820 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: secret -> draft
821 821 $ hg phase --public 17a481b3bccb
822 822 transaction abort!
823 823 rollback completed
@@ -70,8 +70,8 b' expect success'
70 70 remote: adding manifests
71 71 remote: adding file changes
72 72 remote: added 1 changesets with 1 changes to 1 files
73 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: 1 -> 0
74 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> 0
73 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
74 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
75 75 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
76 76 % serve errors
77 77 $ hg rollback
@@ -88,8 +88,8 b' expect success, server lacks the httphea'
88 88 remote: adding manifests
89 89 remote: adding file changes
90 90 remote: added 1 changesets with 1 changes to 1 files
91 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: 1 -> 0
92 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> 0
91 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
92 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
93 93 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
94 94 % serve errors
95 95 $ hg rollback
@@ -106,8 +106,8 b' expect success, server lacks the unbundl'
106 106 remote: adding manifests
107 107 remote: adding file changes
108 108 remote: added 1 changesets with 1 changes to 1 files
109 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: 1 -> 0
110 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> 0
109 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
110 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
111 111 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
112 112 % serve errors
113 113 $ hg rollback
General Comments 0
You need to be logged in to leave comments. Login now