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