##// END OF EJS Templates
test-phases: test changing null revision phase...
Patrick Mezard -
r16622:e4451d74 default
parent child Browse files
Show More
@@ -1,468 +1,477 b''
1 1 $ hglog() { hg log --template "{rev} {phaseidx} {desc}\n" $*; }
2 2 $ mkcommit() {
3 3 > echo "$1" > "$1"
4 4 > hg add "$1"
5 5 > message="$1"
6 6 > shift
7 7 > hg ci -m "$message" $*
8 8 > }
9 9
10 10 $ hg init initialrepo
11 11 $ cd initialrepo
12
13 Cannot change null revision phase
14
15 $ hg phase --force --secret null
16 abort: unknown revision '-1'!
17 [255]
18 $ hg phase null
19 -1: public
20
12 21 $ mkcommit A
13 22
14 23 New commit are draft by default
15 24
16 25 $ hglog
17 26 0 1 A
18 27
19 28 Following commit are draft too
20 29
21 30 $ mkcommit B
22 31
23 32 $ hglog
24 33 1 1 B
25 34 0 1 A
26 35
27 36 Draft commit are properly created over public one:
28 37
29 38 $ hg phase --public .
30 39 $ hglog
31 40 1 0 B
32 41 0 0 A
33 42
34 43 $ mkcommit C
35 44 $ mkcommit D
36 45
37 46 $ hglog
38 47 3 1 D
39 48 2 1 C
40 49 1 0 B
41 50 0 0 A
42 51
43 52 Test creating changeset as secret
44 53
45 54 $ mkcommit E --config phases.new-commit='secret'
46 55 $ hglog
47 56 4 2 E
48 57 3 1 D
49 58 2 1 C
50 59 1 0 B
51 60 0 0 A
52 61
53 62 Test the secret property is inherited
54 63
55 64 $ mkcommit H
56 65 $ hglog
57 66 5 2 H
58 67 4 2 E
59 68 3 1 D
60 69 2 1 C
61 70 1 0 B
62 71 0 0 A
63 72
64 73 Even on merge
65 74
66 75 $ hg up -q 1
67 76 $ mkcommit "B'"
68 77 created new head
69 78 $ hglog
70 79 6 1 B'
71 80 5 2 H
72 81 4 2 E
73 82 3 1 D
74 83 2 1 C
75 84 1 0 B
76 85 0 0 A
77 86 $ hg merge 4 # E
78 87 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
79 88 (branch merge, don't forget to commit)
80 89 $ hg ci -m "merge B' and E"
81 90 $ hglog
82 91 7 2 merge B' and E
83 92 6 1 B'
84 93 5 2 H
85 94 4 2 E
86 95 3 1 D
87 96 2 1 C
88 97 1 0 B
89 98 0 0 A
90 99
91 100 Test secret changeset are not pushed
92 101
93 102 $ hg init ../push-dest
94 103 $ cat > ../push-dest/.hg/hgrc << EOF
95 104 > [phases]
96 105 > publish=False
97 106 > EOF
98 107 $ hg outgoing ../push-dest --template='{rev} {phase} {desc|firstline}\n'
99 108 comparing with ../push-dest
100 109 searching for changes
101 110 0 public A
102 111 1 public B
103 112 2 draft C
104 113 3 draft D
105 114 6 draft B'
106 115 $ hg outgoing -r default ../push-dest --template='{rev} {phase} {desc|firstline}\n'
107 116 comparing with ../push-dest
108 117 searching for changes
109 118 0 public A
110 119 1 public B
111 120 2 draft C
112 121 3 draft D
113 122 6 draft B'
114 123
115 124 $ hg push ../push-dest -f # force because we push multiple heads
116 125 pushing to ../push-dest
117 126 searching for changes
118 127 adding changesets
119 128 adding manifests
120 129 adding file changes
121 130 added 5 changesets with 5 changes to 5 files (+1 heads)
122 131 $ hglog
123 132 7 2 merge B' and E
124 133 6 1 B'
125 134 5 2 H
126 135 4 2 E
127 136 3 1 D
128 137 2 1 C
129 138 1 0 B
130 139 0 0 A
131 140 $ cd ../push-dest
132 141 $ hglog
133 142 4 1 B'
134 143 3 1 D
135 144 2 1 C
136 145 1 0 B
137 146 0 0 A
138 147
139 148 (Issue3303)
140 149 Check that remote secret changeset are ignore when checking creation of remote heads
141 150
142 151 We add a secret head into the push destination. This secreat head shadow a
143 152 visible shared between the initial repo and the push destination.
144 153
145 154 $ hg up -q 4 # B'
146 155 $ mkcommit Z --config phases.new-commit=secret
147 156 $ hg phase .
148 157 5: secret
149 158
150 159 # We now try to push a new public changeset that descend from the common public
151 160 # head shadowed by the remote secret head.
152 161
153 162 $ cd ../initialrepo
154 163 $ hg up -q 6 #B'
155 164 $ mkcommit I
156 165 created new head
157 166 $ hg push ../push-dest
158 167 pushing to ../push-dest
159 168 searching for changes
160 169 adding changesets
161 170 adding manifests
162 171 adding file changes
163 172 added 1 changesets with 1 changes to 1 files (+1 heads)
164 173
165 174 :note: The "(+1 heads)" is wrong as we do not had any visible head
166 175
167 176
168 177 Restore condition prior extra insertion.
169 178 $ hg -q --config extensions.mq= strip .
170 179 $ hg up -q 7
171 180 $ cd ..
172 181
173 182 Test secret changeset are not pull
174 183
175 184 $ hg init pull-dest
176 185 $ cd pull-dest
177 186 $ hg pull ../initialrepo
178 187 pulling from ../initialrepo
179 188 requesting all changes
180 189 adding changesets
181 190 adding manifests
182 191 adding file changes
183 192 added 5 changesets with 5 changes to 5 files (+1 heads)
184 193 (run 'hg heads' to see heads, 'hg merge' to merge)
185 194 $ hglog
186 195 4 0 B'
187 196 3 0 D
188 197 2 0 C
189 198 1 0 B
190 199 0 0 A
191 200 $ cd ..
192 201
193 202 But secret can still be bundled explicitly
194 203
195 204 $ cd initialrepo
196 205 $ hg bundle --base '4^' -r 'children(4)' ../secret-bundle.hg
197 206 4 changesets found
198 207 $ cd ..
199 208
200 209 Test secret changeset are not cloned
201 210 (during local clone)
202 211
203 212 $ hg clone -qU initialrepo clone-dest
204 213 $ hglog -R clone-dest
205 214 4 0 B'
206 215 3 0 D
207 216 2 0 C
208 217 1 0 B
209 218 0 0 A
210 219
211 220 Test revset
212 221
213 222 $ cd initialrepo
214 223 $ hglog -r 'public()'
215 224 0 0 A
216 225 1 0 B
217 226 $ hglog -r 'draft()'
218 227 2 1 C
219 228 3 1 D
220 229 6 1 B'
221 230 $ hglog -r 'secret()'
222 231 4 2 E
223 232 5 2 H
224 233 7 2 merge B' and E
225 234
226 235 test that phase are displayed in log at debug level
227 236
228 237 $ hg log --debug
229 238 changeset: 7:17a481b3bccb796c0521ae97903d81c52bfee4af
230 239 tag: tip
231 240 phase: secret
232 241 parent: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
233 242 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
234 243 manifest: 7:5e724ffacba267b2ab726c91fc8b650710deaaa8
235 244 user: test
236 245 date: Thu Jan 01 00:00:00 1970 +0000
237 246 files+: C D E
238 247 extra: branch=default
239 248 description:
240 249 merge B' and E
241 250
242 251
243 252 changeset: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
244 253 phase: draft
245 254 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
246 255 parent: -1:0000000000000000000000000000000000000000
247 256 manifest: 6:ab8bfef2392903058bf4ebb9e7746e8d7026b27a
248 257 user: test
249 258 date: Thu Jan 01 00:00:00 1970 +0000
250 259 files+: B'
251 260 extra: branch=default
252 261 description:
253 262 B'
254 263
255 264
256 265 changeset: 5:a030c6be5127abc010fcbff1851536552e6951a8
257 266 phase: secret
258 267 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
259 268 parent: -1:0000000000000000000000000000000000000000
260 269 manifest: 5:5c710aa854874fe3d5fa7192e77bdb314cc08b5a
261 270 user: test
262 271 date: Thu Jan 01 00:00:00 1970 +0000
263 272 files+: H
264 273 extra: branch=default
265 274 description:
266 275 H
267 276
268 277
269 278 changeset: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
270 279 phase: secret
271 280 parent: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
272 281 parent: -1:0000000000000000000000000000000000000000
273 282 manifest: 4:7173fd1c27119750b959e3a0f47ed78abe75d6dc
274 283 user: test
275 284 date: Thu Jan 01 00:00:00 1970 +0000
276 285 files+: E
277 286 extra: branch=default
278 287 description:
279 288 E
280 289
281 290
282 291 changeset: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
283 292 phase: draft
284 293 parent: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
285 294 parent: -1:0000000000000000000000000000000000000000
286 295 manifest: 3:6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c
287 296 user: test
288 297 date: Thu Jan 01 00:00:00 1970 +0000
289 298 files+: D
290 299 extra: branch=default
291 300 description:
292 301 D
293 302
294 303
295 304 changeset: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
296 305 phase: draft
297 306 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
298 307 parent: -1:0000000000000000000000000000000000000000
299 308 manifest: 2:66a5a01817fdf5239c273802b5b7618d051c89e4
300 309 user: test
301 310 date: Thu Jan 01 00:00:00 1970 +0000
302 311 files+: C
303 312 extra: branch=default
304 313 description:
305 314 C
306 315
307 316
308 317 changeset: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
309 318 parent: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
310 319 parent: -1:0000000000000000000000000000000000000000
311 320 manifest: 1:cb5cbbc1bfbf24cc34b9e8c16914e9caa2d2a7fd
312 321 user: test
313 322 date: Thu Jan 01 00:00:00 1970 +0000
314 323 files+: B
315 324 extra: branch=default
316 325 description:
317 326 B
318 327
319 328
320 329 changeset: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
321 330 parent: -1:0000000000000000000000000000000000000000
322 331 parent: -1:0000000000000000000000000000000000000000
323 332 manifest: 0:007d8c9d88841325f5c6b06371b35b4e8a2b1a83
324 333 user: test
325 334 date: Thu Jan 01 00:00:00 1970 +0000
326 335 files+: A
327 336 extra: branch=default
328 337 description:
329 338 A
330 339
331 340
332 341
333 342 Test phase command
334 343 ===================
335 344
336 345 initial picture
337 346
338 347 $ cat >> $HGRCPATH << EOF
339 348 > [extensions]
340 349 > hgext.graphlog=
341 350 > EOF
342 351 $ hg log -G --template "{rev} {phase} {desc}\n"
343 352 @ 7 secret merge B' and E
344 353 |\
345 354 | o 6 draft B'
346 355 | |
347 356 +---o 5 secret H
348 357 | |
349 358 o | 4 secret E
350 359 | |
351 360 o | 3 draft D
352 361 | |
353 362 o | 2 draft C
354 363 |/
355 364 o 1 public B
356 365 |
357 366 o 0 public A
358 367
359 368
360 369 display changesets phase
361 370
362 371 (mixing -r and plain rev specification)
363 372
364 373 $ hg phase 1::4 -r 7
365 374 1: public
366 375 2: draft
367 376 3: draft
368 377 4: secret
369 378 7: secret
370 379
371 380
372 381 move changeset forward
373 382
374 383 (with -r option)
375 384
376 385 $ hg phase --public -r 2
377 386 $ hg log -G --template "{rev} {phase} {desc}\n"
378 387 @ 7 secret merge B' and E
379 388 |\
380 389 | o 6 draft B'
381 390 | |
382 391 +---o 5 secret H
383 392 | |
384 393 o | 4 secret E
385 394 | |
386 395 o | 3 draft D
387 396 | |
388 397 o | 2 public C
389 398 |/
390 399 o 1 public B
391 400 |
392 401 o 0 public A
393 402
394 403
395 404 move changeset backward
396 405
397 406 (without -r option)
398 407
399 408 $ hg phase --draft --force 2
400 409 $ hg log -G --template "{rev} {phase} {desc}\n"
401 410 @ 7 secret merge B' and E
402 411 |\
403 412 | o 6 draft B'
404 413 | |
405 414 +---o 5 secret H
406 415 | |
407 416 o | 4 secret E
408 417 | |
409 418 o | 3 draft D
410 419 | |
411 420 o | 2 draft C
412 421 |/
413 422 o 1 public B
414 423 |
415 424 o 0 public A
416 425
417 426
418 427 move changeset forward and backward
419 428
420 429 $ hg phase --draft --force 1::4
421 430 $ hg log -G --template "{rev} {phase} {desc}\n"
422 431 @ 7 secret merge B' and E
423 432 |\
424 433 | o 6 draft B'
425 434 | |
426 435 +---o 5 secret H
427 436 | |
428 437 o | 4 draft E
429 438 | |
430 439 o | 3 draft D
431 440 | |
432 441 o | 2 draft C
433 442 |/
434 443 o 1 draft B
435 444 |
436 445 o 0 public A
437 446
438 447 test partial failure
439 448
440 449 $ hg phase --public 7
441 450 $ hg phase --draft '5 or 7'
442 451 cannot move 1 changesets to a more permissive phase, use --force
443 452 phase changed for 1 changesets
444 453 [1]
445 454 $ hg log -G --template "{rev} {phase} {desc}\n"
446 455 @ 7 public merge B' and E
447 456 |\
448 457 | o 6 public B'
449 458 | |
450 459 +---o 5 draft H
451 460 | |
452 461 o | 4 public E
453 462 | |
454 463 o | 3 public D
455 464 | |
456 465 o | 2 public C
457 466 |/
458 467 o 1 public B
459 468 |
460 469 o 0 public A
461 470
462 471
463 472 test complete failure
464 473
465 474 $ hg phase --draft 7
466 475 cannot move 1 changesets to a more permissive phase, use --force
467 476 no phases changed
468 477 [1]
General Comments 0
You need to be logged in to leave comments. Login now