##// END OF EJS Templates
histedit: test that an aborted histedit can be rerun (with obsolete)...
Pierre-Yves David -
r31639:84242dce default
parent child Browse files
Show More
@@ -1,505 +1,576 b''
1 1 $ . "$TESTDIR/histedit-helpers.sh"
2 2
3 3 Enable obsolete
4 4
5 5 $ cat >> $HGRCPATH << EOF
6 6 > [ui]
7 7 > logtemplate= {rev}:{node|short} {desc|firstline}
8 8 > [phases]
9 9 > publish=False
10 10 > [experimental]
11 11 > evolution=createmarkers,allowunstable
12 12 > [extensions]
13 13 > histedit=
14 14 > rebase=
15 15 > EOF
16 16
17 17 Test that histedit learns about obsolescence not stored in histedit state
18 18 $ hg init boo
19 19 $ cd boo
20 20 $ echo a > a
21 21 $ hg ci -Am a
22 22 adding a
23 23 $ echo a > b
24 24 $ echo a > c
25 25 $ echo a > c
26 26 $ hg ci -Am b
27 27 adding b
28 28 adding c
29 29 $ echo a > d
30 30 $ hg ci -Am c
31 31 adding d
32 32 $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan
33 33 $ echo "pick `hg log -r 2 -T '{node|short}'`" >> plan
34 34 $ echo "edit `hg log -r 1 -T '{node|short}'`" >> plan
35 35 $ hg histedit -r 'all()' --commands plan
36 36 Editing (1b2d564fad96), you may commit or record as needed now.
37 37 (hg histedit --continue to resume)
38 38 [1]
39 39 $ hg st
40 40 A b
41 41 A c
42 42 ? plan
43 43 $ hg commit --amend b
44 44 $ hg histedit --continue
45 45 $ hg log -G
46 46 @ 6:46abc7c4d873 b
47 47 |
48 48 o 5:49d44ab2be1b c
49 49 |
50 50 o 0:cb9a9f314b8b a
51 51
52 52 $ hg debugobsolete
53 53 e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob)
54 54 3e30a45cf2f719e96ab3922dfe039cfd047956ce 0 {e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf} (*) {'user': 'test'} (glob)
55 55 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (*) {'user': 'test'} (glob)
56 56 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob)
57 57
58 58 With some node gone missing during the edit.
59 59
60 60 $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan
61 61 $ echo "pick `hg log -r 6 -T '{node|short}'`" >> plan
62 62 $ echo "edit `hg log -r 5 -T '{node|short}'`" >> plan
63 63 $ hg histedit -r 'all()' --commands plan
64 64 Editing (49d44ab2be1b), you may commit or record as needed now.
65 65 (hg histedit --continue to resume)
66 66 [1]
67 67 $ hg st
68 68 A b
69 69 A d
70 70 ? plan
71 71 $ hg commit --amend -X . -m XXXXXX
72 72 $ hg commit --amend -X . -m b2
73 73 $ hg --hidden --config extensions.strip= strip 'desc(XXXXXX)' --no-backup
74 74 $ hg histedit --continue
75 75 $ hg log -G
76 76 @ 9:273c1f3b8626 c
77 77 |
78 78 o 8:aba7da937030 b2
79 79 |
80 80 o 0:cb9a9f314b8b a
81 81
82 82 $ hg debugobsolete
83 83 e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob)
84 84 3e30a45cf2f719e96ab3922dfe039cfd047956ce 0 {e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf} (*) {'user': 'test'} (glob)
85 85 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (*) {'user': 'test'} (glob)
86 86 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob)
87 87 76f72745eac0643d16530e56e2f86e36e40631f1 2ca853e48edbd6453a0674dc0fe28a0974c51b9c 0 (*) {'user': 'test'} (glob)
88 88 2ca853e48edbd6453a0674dc0fe28a0974c51b9c aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (*) {'user': 'test'} (glob)
89 89 49d44ab2be1b67a79127568a67c9c99430633b48 273c1f3b86267ed3ec684bb13af1fa4d6ba56e02 0 (*) {'user': 'test'} (glob)
90 90 46abc7c4d8738e8563e577f7889e1b6db3da4199 aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (*) {'user': 'test'} (glob)
91 91 $ cd ..
92 92
93 93 Base setup for the rest of the testing
94 94 ======================================
95 95
96 96 $ hg init base
97 97 $ cd base
98 98
99 99 $ for x in a b c d e f ; do
100 100 > echo $x > $x
101 101 > hg add $x
102 102 > hg ci -m $x
103 103 > done
104 104
105 105 $ hg log --graph
106 106 @ 5:652413bf663e f
107 107 |
108 108 o 4:e860deea161a e
109 109 |
110 110 o 3:055a42cdd887 d
111 111 |
112 112 o 2:177f92b77385 c
113 113 |
114 114 o 1:d2ae7f538514 b
115 115 |
116 116 o 0:cb9a9f314b8b a
117 117
118 118
119 119 $ HGEDITOR=cat hg histedit 1
120 120 pick d2ae7f538514 1 b
121 121 pick 177f92b77385 2 c
122 122 pick 055a42cdd887 3 d
123 123 pick e860deea161a 4 e
124 124 pick 652413bf663e 5 f
125 125
126 126 # Edit history between d2ae7f538514 and 652413bf663e
127 127 #
128 128 # Commits are listed from least to most recent
129 129 #
130 130 # You can reorder changesets by reordering the lines
131 131 #
132 132 # Commands:
133 133 #
134 134 # e, edit = use commit, but stop for amending
135 135 # m, mess = edit commit message without changing commit content
136 136 # p, pick = use commit
137 137 # d, drop = remove commit from history
138 138 # f, fold = use commit, but combine it with the one above
139 139 # r, roll = like fold, but discard this commit's description and date
140 140 #
141 141 $ hg histedit 1 --commands - --verbose <<EOF | grep histedit
142 142 > pick 177f92b77385 2 c
143 143 > drop d2ae7f538514 1 b
144 144 > pick 055a42cdd887 3 d
145 145 > fold e860deea161a 4 e
146 146 > pick 652413bf663e 5 f
147 147 > EOF
148 148 [1]
149 149 $ hg log --graph --hidden
150 150 @ 10:cacdfd884a93 f
151 151 |
152 152 o 9:59d9f330561f d
153 153 |
154 154 | x 8:b558abc46d09 fold-temp-revision e860deea161a
155 155 | |
156 156 | x 7:96e494a2d553 d
157 157 |/
158 158 o 6:b346ab9a313d c
159 159 |
160 160 | x 5:652413bf663e f
161 161 | |
162 162 | x 4:e860deea161a e
163 163 | |
164 164 | x 3:055a42cdd887 d
165 165 | |
166 166 | x 2:177f92b77385 c
167 167 | |
168 168 | x 1:d2ae7f538514 b
169 169 |/
170 170 o 0:cb9a9f314b8b a
171 171
172 172 $ hg debugobsolete
173 173 96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 {b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (*) {'user': 'test'} (glob)
174 174 b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 {96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (*) {'user': 'test'} (glob)
175 175 d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 {cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (*) {'user': 'test'} (glob)
176 176 177f92b773850b59254aa5e923436f921b55483b b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (*) {'user': 'test'} (glob)
177 177 055a42cdd88768532f9cf79daa407fc8d138de9b 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (*) {'user': 'test'} (glob)
178 178 e860deea161a2f77de56603b340ebbb4536308ae 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (*) {'user': 'test'} (glob)
179 179 652413bf663ef2a641cab26574e46d5f5a64a55a cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (*) {'user': 'test'} (glob)
180 180
181 181
182 182 Ensure hidden revision does not prevent histedit
183 183 -------------------------------------------------
184 184
185 185 create an hidden revision
186 186
187 187 $ hg histedit 6 --commands - << EOF
188 188 > pick b346ab9a313d 6 c
189 189 > drop 59d9f330561f 7 d
190 190 > pick cacdfd884a93 8 f
191 191 > EOF
192 192 $ hg log --graph
193 193 @ 11:c13eb81022ca f
194 194 |
195 195 o 6:b346ab9a313d c
196 196 |
197 197 o 0:cb9a9f314b8b a
198 198
199 199 check hidden revision are ignored (6 have hidden children 7 and 8)
200 200
201 201 $ hg histedit 6 --commands - << EOF
202 202 > pick b346ab9a313d 6 c
203 203 > pick c13eb81022ca 8 f
204 204 > EOF
205 205
206 206
207 207
208 208 Test that rewriting leaving instability behind is allowed
209 209 ---------------------------------------------------------------------
210 210
211 211 $ hg up '.^'
212 212 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
213 213 $ hg log -r 'children(.)'
214 214 11:c13eb81022ca f (no-eol)
215 215 $ hg histedit -r '.' --commands - <<EOF
216 216 > edit b346ab9a313d 6 c
217 217 > EOF
218 218 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
219 219 adding c
220 220 Editing (b346ab9a313d), you may commit or record as needed now.
221 221 (hg histedit --continue to resume)
222 222 [1]
223 223 $ echo c >> c
224 224 $ hg histedit --continue
225 225
226 226 $ hg log -r 'unstable()'
227 227 11:c13eb81022ca f (no-eol)
228 228
229 229 stabilise
230 230
231 231 $ hg rebase -r 'unstable()' -d .
232 232 rebasing 11:c13eb81022ca "f"
233 233 $ hg up tip -q
234 234
235 235 Test dropping of changeset on the top of the stack
236 236 -------------------------------------------------------
237 237
238 238 Nothing is rewritten below, the working directory parent must be change for the
239 239 dropped changeset to be hidden.
240 240
241 241 $ cd ..
242 242 $ hg clone base droplast
243 243 updating to branch default
244 244 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
245 245 $ cd droplast
246 246 $ hg histedit -r '40db8afa467b' --commands - << EOF
247 247 > pick 40db8afa467b 10 c
248 248 > drop b449568bf7fc 11 f
249 249 > EOF
250 250 $ hg log -G
251 251 @ 12:40db8afa467b c
252 252 |
253 253 o 0:cb9a9f314b8b a
254 254
255 255
256 256 With rewritten ancestors
257 257
258 258 $ echo e > e
259 259 $ hg add e
260 260 $ hg commit -m g
261 261 $ echo f > f
262 262 $ hg add f
263 263 $ hg commit -m h
264 264 $ hg histedit -r '40db8afa467b' --commands - << EOF
265 265 > pick 47a8561c0449 12 g
266 266 > pick 40db8afa467b 10 c
267 267 > drop 1b3b05f35ff0 13 h
268 268 > EOF
269 269 $ hg log -G
270 270 @ 17:ee6544123ab8 c
271 271 |
272 272 o 16:269e713e9eae g
273 273 |
274 274 o 0:cb9a9f314b8b a
275 275
276 276 $ cd ../base
277 277
278 278
279 279
280 280 Test phases support
281 281 ===========================================
282 282
283 283 Check that histedit respect immutability
284 284 -------------------------------------------
285 285
286 286 $ cat >> $HGRCPATH << EOF
287 287 > [ui]
288 288 > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n
289 289 > EOF
290 290
291 291 $ hg ph -pv '.^'
292 292 phase changed for 2 changesets
293 293 $ hg log -G
294 294 @ 13:b449568bf7fc (draft) f
295 295 |
296 296 o 12:40db8afa467b (public) c
297 297 |
298 298 o 0:cb9a9f314b8b (public) a
299 299
300 300 $ hg histedit -r '.~2'
301 301 abort: cannot edit public changeset: cb9a9f314b8b
302 302 (see 'hg help phases' for details)
303 303 [255]
304 304
305 305
306 306 Prepare further testing
307 307 -------------------------------------------
308 308
309 309 $ for x in g h i j k ; do
310 310 > echo $x > $x
311 311 > hg add $x
312 312 > hg ci -m $x
313 313 > done
314 314 $ hg phase --force --secret .~2
315 315 $ hg log -G
316 316 @ 18:ee118ab9fa44 (secret) k
317 317 |
318 318 o 17:3a6c53ee7f3d (secret) j
319 319 |
320 320 o 16:b605fb7503f2 (secret) i
321 321 |
322 322 o 15:7395e1ff83bd (draft) h
323 323 |
324 324 o 14:6b70183d2492 (draft) g
325 325 |
326 326 o 13:b449568bf7fc (draft) f
327 327 |
328 328 o 12:40db8afa467b (public) c
329 329 |
330 330 o 0:cb9a9f314b8b (public) a
331 331
332 332 $ cd ..
333 333
334 334 simple phase conservation
335 335 -------------------------------------------
336 336
337 337 Resulting changeset should conserve the phase of the original one whatever the
338 338 phases.new-commit option is.
339 339
340 340 New-commit as draft (default)
341 341
342 342 $ cp -R base simple-draft
343 343 $ cd simple-draft
344 344 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
345 345 > edit b449568bf7fc 11 f
346 346 > pick 6b70183d2492 12 g
347 347 > pick 7395e1ff83bd 13 h
348 348 > pick b605fb7503f2 14 i
349 349 > pick 3a6c53ee7f3d 15 j
350 350 > pick ee118ab9fa44 16 k
351 351 > EOF
352 352 0 files updated, 0 files merged, 6 files removed, 0 files unresolved
353 353 adding f
354 354 Editing (b449568bf7fc), you may commit or record as needed now.
355 355 (hg histedit --continue to resume)
356 356 [1]
357 357 $ echo f >> f
358 358 $ hg histedit --continue
359 359 $ hg log -G
360 360 @ 24:12e89af74238 (secret) k
361 361 |
362 362 o 23:636a8687b22e (secret) j
363 363 |
364 364 o 22:ccaf0a38653f (secret) i
365 365 |
366 366 o 21:11a89d1c2613 (draft) h
367 367 |
368 368 o 20:c1dec7ca82ea (draft) g
369 369 |
370 370 o 19:087281e68428 (draft) f
371 371 |
372 372 o 12:40db8afa467b (public) c
373 373 |
374 374 o 0:cb9a9f314b8b (public) a
375 375
376 376 $ cd ..
377 377
378 378
379 379 New-commit as secret (config)
380 380
381 381 $ cp -R base simple-secret
382 382 $ cd simple-secret
383 383 $ cat >> .hg/hgrc << EOF
384 384 > [phases]
385 385 > new-commit=secret
386 386 > EOF
387 387 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
388 388 > edit b449568bf7fc 11 f
389 389 > pick 6b70183d2492 12 g
390 390 > pick 7395e1ff83bd 13 h
391 391 > pick b605fb7503f2 14 i
392 392 > pick 3a6c53ee7f3d 15 j
393 393 > pick ee118ab9fa44 16 k
394 394 > EOF
395 395 0 files updated, 0 files merged, 6 files removed, 0 files unresolved
396 396 adding f
397 397 Editing (b449568bf7fc), you may commit or record as needed now.
398 398 (hg histedit --continue to resume)
399 399 [1]
400 400 $ echo f >> f
401 401 $ hg histedit --continue
402 402 $ hg log -G
403 403 @ 24:12e89af74238 (secret) k
404 404 |
405 405 o 23:636a8687b22e (secret) j
406 406 |
407 407 o 22:ccaf0a38653f (secret) i
408 408 |
409 409 o 21:11a89d1c2613 (draft) h
410 410 |
411 411 o 20:c1dec7ca82ea (draft) g
412 412 |
413 413 o 19:087281e68428 (draft) f
414 414 |
415 415 o 12:40db8afa467b (public) c
416 416 |
417 417 o 0:cb9a9f314b8b (public) a
418 418
419 419 $ cd ..
420 420
421 421
422 422 Changeset reordering
423 423 -------------------------------------------
424 424
425 425 If a secret changeset is put before a draft one, all descendant should be secret.
426 426 It seems more important to present the secret phase.
427 427
428 428 $ cp -R base reorder
429 429 $ cd reorder
430 430 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
431 431 > pick b449568bf7fc 11 f
432 432 > pick 3a6c53ee7f3d 15 j
433 433 > pick 6b70183d2492 12 g
434 434 > pick b605fb7503f2 14 i
435 435 > pick 7395e1ff83bd 13 h
436 436 > pick ee118ab9fa44 16 k
437 437 > EOF
438 438 $ hg log -G
439 439 @ 23:558246857888 (secret) k
440 440 |
441 441 o 22:28bd44768535 (secret) h
442 442 |
443 443 o 21:d5395202aeb9 (secret) i
444 444 |
445 445 o 20:21edda8e341b (secret) g
446 446 |
447 447 o 19:5ab64f3a4832 (secret) j
448 448 |
449 449 o 13:b449568bf7fc (draft) f
450 450 |
451 451 o 12:40db8afa467b (public) c
452 452 |
453 453 o 0:cb9a9f314b8b (public) a
454 454
455 455 $ cd ..
456 456
457 457 Changeset folding
458 458 -------------------------------------------
459 459
460 460 Folding a secret changeset with a draft one turn the result secret (again,
461 461 better safe than sorry). Folding between same phase changeset still works
462 462
463 463 Note that there is a few reordering in this series for more extensive test
464 464
465 465 $ cp -R base folding
466 466 $ cd folding
467 467 $ cat >> .hg/hgrc << EOF
468 468 > [phases]
469 469 > new-commit=secret
470 470 > EOF
471 471 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
472 472 > pick 7395e1ff83bd 13 h
473 473 > fold b449568bf7fc 11 f
474 474 > pick 6b70183d2492 12 g
475 475 > fold 3a6c53ee7f3d 15 j
476 476 > pick b605fb7503f2 14 i
477 477 > fold ee118ab9fa44 16 k
478 478 > EOF
479 479 $ hg log -G
480 480 @ 27:f9daec13fb98 (secret) i
481 481 |
482 482 o 24:49807617f46a (secret) g
483 483 |
484 484 o 21:050280826e04 (draft) h
485 485 |
486 486 o 12:40db8afa467b (public) c
487 487 |
488 488 o 0:cb9a9f314b8b (public) a
489 489
490 490 $ hg co 49807617f46a
491 491 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
492 492 $ echo wat >> wat
493 493 $ hg add wat
494 494 $ hg ci -m 'add wat'
495 495 created new head
496 496 $ hg merge f9daec13fb98
497 497 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
498 498 (branch merge, don't forget to commit)
499 499 $ hg ci -m 'merge'
500 500 $ echo not wat > wat
501 501 $ hg ci -m 'modify wat'
502 502 $ hg histedit 050280826e04
503 503 abort: cannot edit history that contains merges
504 504 [255]
505 505 $ cd ..
506
507 Check abort behavior
508 -------------------------------------------
509
510 We checks that abort properly clean the repository so the same histedit can be
511 attempted later.
512
513 $ cp -R base abort
514 $ cd abort
515 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
516 > pick b449568bf7fc 13 f
517 > pick 7395e1ff83bd 15 h
518 > pick 6b70183d2492 14 g
519 > pick b605fb7503f2 16 i
520 > roll 3a6c53ee7f3d 17 j
521 > edit ee118ab9fa44 18 k
522 > EOF
523 Editing (ee118ab9fa44), you may commit or record as needed now.
524 (hg histedit --continue to resume)
525 [1]
526
527 $ hg histedit --abort
528 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
529 saved backup bundle to $TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg (glob)
530
531 $ hg log -G
532 @ 18:ee118ab9fa44 (secret) k
533 |
534 o 17:3a6c53ee7f3d (secret) j
535 |
536 o 16:b605fb7503f2 (secret) i
537 |
538 o 15:7395e1ff83bd (draft) h
539 |
540 o 14:6b70183d2492 (draft) g
541 |
542 o 13:b449568bf7fc (draft) f
543 |
544 o 12:40db8afa467b (public) c
545 |
546 o 0:cb9a9f314b8b (public) a
547
548 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
549 > pick b449568bf7fc 13 f
550 > pick 7395e1ff83bd 15 h
551 > pick 6b70183d2492 14 g
552 > pick b605fb7503f2 16 i
553 > pick 3a6c53ee7f3d 17 j
554 > edit ee118ab9fa44 18 k
555 > EOF
556 Editing (ee118ab9fa44), you may commit or record as needed now.
557 (hg histedit --continue to resume)
558 [1]
559 $ hg histedit --continue
560 $ hg log -G
561 @ 23:175d6b286a22 (secret) k
562 |
563 o 22:44ca09d59ae4 (secret) j
564 |
565 o 21:31747692a644 (secret) i
566 |
567 o 20:9985cd4f21fa (draft) g
568 |
569 o 19:4dc06258baa6 (draft) h
570 |
571 o 13:b449568bf7fc (draft) f
572 |
573 o 12:40db8afa467b (public) c
574 |
575 o 0:cb9a9f314b8b (public) a
576
General Comments 0
You need to be logged in to leave comments. Login now