##// END OF EJS Templates
tests: add some b-prefixes on local script in test-histedit-arguments...
Augie Fackler -
r36190:21f4697e default
parent child Browse files
Show More
@@ -1,554 +1,554 b''
1 1 Test argument handling and various data parsing
2 2 ==================================================
3 3
4 4
5 5 Enable extensions used by this test.
6 6 $ cat >>$HGRCPATH <<EOF
7 7 > [extensions]
8 8 > histedit=
9 9 > EOF
10 10
11 11 Repo setup.
12 12 $ hg init foo
13 13 $ cd foo
14 14 $ echo alpha >> alpha
15 15 $ hg addr
16 16 adding alpha
17 17 $ hg ci -m one
18 18 $ echo alpha >> alpha
19 19 $ hg ci -m two
20 20 $ echo alpha >> alpha
21 21 $ hg ci -m three
22 22 $ echo alpha >> alpha
23 23 $ hg ci -m four
24 24 $ echo alpha >> alpha
25 25 $ hg ci -m five
26 26
27 27 $ hg log --style compact --graph
28 28 @ 4[tip] 08d98a8350f3 1970-01-01 00:00 +0000 test
29 29 | five
30 30 |
31 31 o 3 c8e68270e35a 1970-01-01 00:00 +0000 test
32 32 | four
33 33 |
34 34 o 2 eb57da33312f 1970-01-01 00:00 +0000 test
35 35 | three
36 36 |
37 37 o 1 579e40513370 1970-01-01 00:00 +0000 test
38 38 | two
39 39 |
40 40 o 0 6058cbb6cfd7 1970-01-01 00:00 +0000 test
41 41 one
42 42
43 43
44 44 histedit --continue/--abort with no existing state
45 45 --------------------------------------------------
46 46
47 47 $ hg histedit --continue
48 48 abort: no histedit in progress
49 49 [255]
50 50 $ hg histedit --abort
51 51 abort: no histedit in progress
52 52 [255]
53 53
54 54 Run a dummy edit to make sure we get tip^^ correctly via revsingle.
55 55 --------------------------------------------------------------------
56 56
57 57 $ HGEDITOR=cat hg histedit "tip^^"
58 58 pick eb57da33312f 2 three
59 59 pick c8e68270e35a 3 four
60 60 pick 08d98a8350f3 4 five
61 61
62 62 # Edit history between eb57da33312f and 08d98a8350f3
63 63 #
64 64 # Commits are listed from least to most recent
65 65 #
66 66 # You can reorder changesets by reordering the lines
67 67 #
68 68 # Commands:
69 69 #
70 70 # e, edit = use commit, but stop for amending
71 71 # m, mess = edit commit message without changing commit content
72 72 # p, pick = use commit
73 73 # b, base = checkout changeset and apply further changesets from there
74 74 # d, drop = remove commit from history
75 75 # f, fold = use commit, but combine it with the one above
76 76 # r, roll = like fold, but discard this commit's description and date
77 77 #
78 78
79 79 Run on a revision not ancestors of the current working directory.
80 80 --------------------------------------------------------------------
81 81
82 82 $ hg up 2
83 83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 84 $ hg histedit -r 4
85 85 abort: 08d98a8350f3 is not an ancestor of working directory
86 86 [255]
87 87 $ hg up --quiet
88 88
89 89
90 90 Test that we pick the minimum of a revrange
91 91 ---------------------------------------
92 92
93 93 $ HGEDITOR=cat hg histedit '2::' --commands - << EOF
94 94 > pick eb57da33312f 2 three
95 95 > pick c8e68270e35a 3 four
96 96 > pick 08d98a8350f3 4 five
97 97 > EOF
98 98 $ hg up --quiet
99 99
100 100 $ HGEDITOR=cat hg histedit 'tip:2' --commands - << EOF
101 101 > pick eb57da33312f 2 three
102 102 > pick c8e68270e35a 3 four
103 103 > pick 08d98a8350f3 4 five
104 104 > EOF
105 105 $ hg up --quiet
106 106
107 107 Test config specified default
108 108 -----------------------------
109 109
110 110 $ HGEDITOR=cat hg histedit --config "histedit.defaultrev=only(.) - ::eb57da33312f" --commands - << EOF
111 111 > pick c8e68270e35a 3 four
112 112 > pick 08d98a8350f3 4 five
113 113 > EOF
114 114
115 115 Run on a revision not descendants of the initial parent
116 116 --------------------------------------------------------------------
117 117
118 118 Test the message shown for inconsistent histedit state, which may be
119 119 created (and forgotten) by Mercurial earlier than 2.7. This emulates
120 120 Mercurial earlier than 2.7 by renaming ".hg/histedit-state"
121 121 temporarily.
122 122
123 123 $ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2::
124 124 @ 4 08d9 five
125 125 |
126 126 o 3 c8e6 four
127 127 |
128 128 o 2 eb57 three
129 129 |
130 130 ~
131 131 $ HGEDITOR=cat hg histedit -r 4 --commands - << EOF
132 132 > edit 08d98a8350f3 4 five
133 133 > EOF
134 134 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
135 135 reverting alpha
136 136 Editing (08d98a8350f3), you may commit or record as needed now.
137 137 (hg histedit --continue to resume)
138 138 [1]
139 139
140 140 $ hg graft --continue
141 141 abort: no graft in progress
142 142 (continue: hg histedit --continue)
143 143 [255]
144 144
145 145 $ mv .hg/histedit-state .hg/histedit-state.back
146 146 $ hg update --quiet --clean 2
147 147 $ echo alpha >> alpha
148 148 $ mv .hg/histedit-state.back .hg/histedit-state
149 149
150 150 $ hg histedit --continue
151 151 saved backup bundle to $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-histedit.hg
152 152 $ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2::
153 153 @ 4 f5ed five
154 154 |
155 155 | o 3 c8e6 four
156 156 |/
157 157 o 2 eb57 three
158 158 |
159 159 ~
160 160
161 161 $ hg unbundle -q $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-histedit.hg
162 162 $ hg strip -q -r f5ed --config extensions.strip=
163 163 $ hg up -q 08d98a8350f3
164 164
165 165 Test that missing revisions are detected
166 166 ---------------------------------------
167 167
168 168 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
169 169 > pick eb57da33312f 2 three
170 170 > pick 08d98a8350f3 4 five
171 171 > EOF
172 172 hg: parse error: missing rules for changeset c8e68270e35a
173 173 (use "drop c8e68270e35a" to discard, see also: 'hg help -e histedit.config')
174 174 [255]
175 175
176 176 Test that extra revisions are detected
177 177 ---------------------------------------
178 178
179 179 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
180 180 > pick 6058cbb6cfd7 0 one
181 181 > pick c8e68270e35a 3 four
182 182 > pick 08d98a8350f3 4 five
183 183 > EOF
184 184 hg: parse error: pick "6058cbb6cfd7" changeset was not a candidate
185 185 (only use listed changesets)
186 186 [255]
187 187
188 188 Test malformed line
189 189 ---------------------------------------
190 190
191 191 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
192 192 > pickeb57da33312f2three
193 193 > pick c8e68270e35a 3 four
194 194 > pick 08d98a8350f3 4 five
195 195 > EOF
196 196 hg: parse error: malformed line "pickeb57da33312f2three"
197 197 [255]
198 198
199 199 Test unknown changeset
200 200 ---------------------------------------
201 201
202 202 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
203 203 > pick 0123456789ab 2 three
204 204 > pick c8e68270e35a 3 four
205 205 > pick 08d98a8350f3 4 five
206 206 > EOF
207 207 hg: parse error: unknown changeset 0123456789ab listed
208 208 [255]
209 209
210 210 Test unknown command
211 211 ---------------------------------------
212 212
213 213 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
214 214 > coin eb57da33312f 2 three
215 215 > pick c8e68270e35a 3 four
216 216 > pick 08d98a8350f3 4 five
217 217 > EOF
218 218 hg: parse error: unknown action "coin"
219 219 [255]
220 220
221 221 Test duplicated changeset
222 222 ---------------------------------------
223 223
224 224 So one is missing and one appear twice.
225 225
226 226 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
227 227 > pick eb57da33312f 2 three
228 228 > pick eb57da33312f 2 three
229 229 > pick 08d98a8350f3 4 five
230 230 > EOF
231 231 hg: parse error: duplicated command for changeset eb57da33312f
232 232 [255]
233 233
234 234 Test bogus rev
235 235 ---------------------------------------
236 236
237 237 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
238 238 > pick eb57da33312f 2 three
239 239 > pick 0
240 240 > pick 08d98a8350f3 4 five
241 241 > EOF
242 242 hg: parse error: invalid changeset 0
243 243 [255]
244 244
245 245 Test short version of command
246 246 ---------------------------------------
247 247
248 248 Note: we use varying amounts of white space between command name and changeset
249 249 short hash. This tests issue3893.
250 250
251 251 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
252 252 > pick eb57da33312f 2 three
253 253 > p c8e68270e35a 3 four
254 254 > f 08d98a8350f3 4 five
255 255 > EOF
256 256 four
257 257 ***
258 258 five
259 259
260 260
261 261
262 262 HG: Enter commit message. Lines beginning with 'HG:' are removed.
263 263 HG: Leave message empty to abort commit.
264 264 HG: --
265 265 HG: user: test
266 266 HG: branch 'default'
267 267 HG: changed alpha
268 268 saved backup bundle to $TESTTMP/foo/.hg/strip-backup/c8e68270e35a-63d8b8d8-histedit.hg
269 269
270 270 $ hg update -q 2
271 271 $ echo x > x
272 272 $ hg add x
273 273 $ hg commit -m'x' x
274 274 created new head
275 275 $ hg histedit -r 'heads(all())'
276 276 abort: The specified revisions must have exactly one common root
277 277 [255]
278 278
279 279 Test that trimming description using multi-byte characters
280 280 --------------------------------------------------------------------
281 281
282 282 $ $PYTHON <<EOF
283 > fp = open('logfile', 'w')
284 > fp.write('12345678901234567890123456789012345678901234567890' +
285 > '12345') # there are 5 more columns for 80 columns
283 > fp = open('logfile', 'wb')
284 > fp.write(b'12345678901234567890123456789012345678901234567890' +
285 > b'12345') # there are 5 more columns for 80 columns
286 286 >
287 287 > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
288 288 > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
289 289 >
290 290 > fp.close()
291 291 > EOF
292 292 $ echo xx >> x
293 293 $ hg --encoding utf-8 commit --logfile logfile
294 294
295 295 $ HGEDITOR=cat hg --encoding utf-8 histedit tip
296 296 pick 3d3ea1f3a10b 5 1234567890123456789012345678901234567890123456789012345\xe3\x81\x82... (esc)
297 297
298 298 # Edit history between 3d3ea1f3a10b and 3d3ea1f3a10b
299 299 #
300 300 # Commits are listed from least to most recent
301 301 #
302 302 # You can reorder changesets by reordering the lines
303 303 #
304 304 # Commands:
305 305 #
306 306 # e, edit = use commit, but stop for amending
307 307 # m, mess = edit commit message without changing commit content
308 308 # p, pick = use commit
309 309 # b, base = checkout changeset and apply further changesets from there
310 310 # d, drop = remove commit from history
311 311 # f, fold = use commit, but combine it with the one above
312 312 # r, roll = like fold, but discard this commit's description and date
313 313 #
314 314
315 315 Test --continue with --keep
316 316
317 317 $ hg strip -q -r . --config extensions.strip=
318 318 $ hg histedit '.^' -q --keep --commands - << EOF
319 319 > edit eb57da33312f 2 three
320 320 > pick f3cfcca30c44 4 x
321 321 > EOF
322 322 Editing (eb57da33312f), you may commit or record as needed now.
323 323 (hg histedit --continue to resume)
324 324 [1]
325 325 $ echo edit >> alpha
326 326 $ hg histedit -q --continue
327 327 $ hg log -G -T '{rev}:{node|short} {desc}'
328 328 @ 6:8fda0c726bf2 x
329 329 |
330 330 o 5:63379946892c three
331 331 |
332 332 | o 4:f3cfcca30c44 x
333 333 | |
334 334 | | o 3:2a30f3cfee78 four
335 335 | |/ ***
336 336 | | five
337 337 | o 2:eb57da33312f three
338 338 |/
339 339 o 1:579e40513370 two
340 340 |
341 341 o 0:6058cbb6cfd7 one
342 342
343 343
344 344 Test that abort fails gracefully on exception
345 345 ----------------------------------------------
346 346 $ hg histedit . -q --commands - << EOF
347 347 > edit 8fda0c726bf2 6 x
348 348 > EOF
349 349 Editing (8fda0c726bf2), you may commit or record as needed now.
350 350 (hg histedit --continue to resume)
351 351 [1]
352 352 Corrupt histedit state file
353 353 $ sed 's/8fda0c726bf2/123456789012/' .hg/histedit-state > ../corrupt-histedit
354 354 $ mv ../corrupt-histedit .hg/histedit-state
355 355 $ hg histedit --abort
356 356 warning: encountered an exception during histedit --abort; the repository may not have been completely cleaned up
357 357 abort: $TESTTMP/foo/.hg/strip-backup/*-histedit.hg: $ENOENT$ (glob) (windows !)
358 358 abort: $ENOENT$: $TESTTMP/foo/.hg/strip-backup/*-histedit.hg (glob) (no-windows !)
359 359 [255]
360 360 Histedit state has been exited
361 361 $ hg summary -q
362 362 parent: 5:63379946892c
363 363 commit: 1 added, 1 unknown (new branch head)
364 364 update: 4 new changesets (update)
365 365
366 366 $ cd ..
367 367
368 368 Set up default base revision tests
369 369
370 370 $ hg init defaultbase
371 371 $ cd defaultbase
372 372 $ touch foo
373 373 $ hg -q commit -A -m root
374 374 $ echo 1 > foo
375 375 $ hg commit -m 'public 1'
376 376 $ hg phase --force --public -r .
377 377 $ echo 2 > foo
378 378 $ hg commit -m 'draft after public'
379 379 $ hg -q up -r 1
380 380 $ echo 3 > foo
381 381 $ hg commit -m 'head 1 public'
382 382 created new head
383 383 $ hg phase --force --public -r .
384 384 $ echo 4 > foo
385 385 $ hg commit -m 'head 1 draft 1'
386 386 $ echo 5 > foo
387 387 $ hg commit -m 'head 1 draft 2'
388 388 $ hg -q up -r 2
389 389 $ echo 6 > foo
390 390 $ hg commit -m 'head 2 commit 1'
391 391 $ echo 7 > foo
392 392 $ hg commit -m 'head 2 commit 2'
393 393 $ hg -q up -r 2
394 394 $ echo 8 > foo
395 395 $ hg commit -m 'head 3'
396 396 created new head
397 397 $ hg -q up -r 2
398 398 $ echo 9 > foo
399 399 $ hg commit -m 'head 4'
400 400 created new head
401 401 $ hg merge --tool :local -r 8
402 402 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
403 403 (branch merge, don't forget to commit)
404 404 $ hg commit -m 'merge head 3 into head 4'
405 405 $ echo 11 > foo
406 406 $ hg commit -m 'commit 1 after merge'
407 407 $ echo 12 > foo
408 408 $ hg commit -m 'commit 2 after merge'
409 409
410 410 $ hg log -G -T '{rev}:{node|short} {phase} {desc}\n'
411 411 @ 12:8cde254db839 draft commit 2 after merge
412 412 |
413 413 o 11:6f2f0241f119 draft commit 1 after merge
414 414 |
415 415 o 10:90506cc76b00 draft merge head 3 into head 4
416 416 |\
417 417 | o 9:f8607a373a97 draft head 4
418 418 | |
419 419 o | 8:0da92be05148 draft head 3
420 420 |/
421 421 | o 7:4c35cdf97d5e draft head 2 commit 2
422 422 | |
423 423 | o 6:931820154288 draft head 2 commit 1
424 424 |/
425 425 | o 5:8cdc02b9bc63 draft head 1 draft 2
426 426 | |
427 427 | o 4:463b8c0d2973 draft head 1 draft 1
428 428 | |
429 429 | o 3:23a0c4eefcbf public head 1 public
430 430 | |
431 431 o | 2:4117331c3abb draft draft after public
432 432 |/
433 433 o 1:4426d359ea59 public public 1
434 434 |
435 435 o 0:54136a8ddf32 public root
436 436
437 437
438 438 Default base revision should stop at public changesets
439 439
440 440 $ hg -q up 8cdc02b9bc63
441 441 $ hg histedit --commands - <<EOF
442 442 > pick 463b8c0d2973
443 443 > pick 8cdc02b9bc63
444 444 > EOF
445 445
446 446 Default base revision should stop at branchpoint
447 447
448 448 $ hg -q up 4c35cdf97d5e
449 449 $ hg histedit --commands - <<EOF
450 450 > pick 931820154288
451 451 > pick 4c35cdf97d5e
452 452 > EOF
453 453
454 454 Default base revision should stop at merge commit
455 455
456 456 $ hg -q up 8cde254db839
457 457 $ hg histedit --commands - <<EOF
458 458 > pick 6f2f0241f119
459 459 > pick 8cde254db839
460 460 > EOF
461 461
462 462 commit --amend should abort if histedit is in progress
463 463 (issue4800) and markers are not being created.
464 464 Eventually, histedit could perhaps look at `source` extra,
465 465 in which case this test should be revisited.
466 466
467 467 $ hg -q up 8cde254db839
468 468 $ hg histedit 6f2f0241f119 --commands - <<EOF
469 469 > pick 8cde254db839
470 470 > edit 6f2f0241f119
471 471 > EOF
472 472 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
473 473 merging foo
474 474 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
475 475 Fix up the change (pick 8cde254db839)
476 476 (hg histedit --continue to resume)
477 477 [1]
478 478 $ hg resolve -m --all
479 479 (no more unresolved files)
480 480 continue: hg histedit --continue
481 481 $ hg histedit --cont
482 482 merging foo
483 483 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
484 484 Editing (6f2f0241f119), you may commit or record as needed now.
485 485 (hg histedit --continue to resume)
486 486 [1]
487 487 $ hg resolve -m --all
488 488 (no more unresolved files)
489 489 continue: hg histedit --continue
490 490 $ hg commit --amend -m 'reject this fold'
491 491 abort: histedit in progress
492 492 (use 'hg histedit --continue' or 'hg histedit --abort')
493 493 [255]
494 494
495 495 With markers enabled, histedit does not get confused, and
496 496 amend should not be blocked by the ongoing histedit.
497 497
498 498 $ cat >>$HGRCPATH <<EOF
499 499 > [experimental]
500 500 > evolution.createmarkers=True
501 501 > evolution.allowunstable=True
502 502 > EOF
503 503 $ hg commit --amend -m 'allow this fold'
504 504 $ hg histedit --continue
505 505
506 506 $ cd ..
507 507
508 508 Test autoverb feature
509 509
510 510 $ hg init autoverb
511 511 $ cd autoverb
512 512 $ echo alpha >> alpha
513 513 $ hg ci -qAm one
514 514 $ echo alpha >> alpha
515 515 $ hg ci -qm two
516 516 $ echo beta >> beta
517 517 $ hg ci -qAm "roll! one"
518 518
519 519 $ hg log --style compact --graph
520 520 @ 2[tip] 4f34d0f8b5fa 1970-01-01 00:00 +0000 test
521 521 | roll! one
522 522 |
523 523 o 1 579e40513370 1970-01-01 00:00 +0000 test
524 524 | two
525 525 |
526 526 o 0 6058cbb6cfd7 1970-01-01 00:00 +0000 test
527 527 one
528 528
529 529
530 530 Check that 'roll' is selected by default
531 531
532 532 $ HGEDITOR=cat hg histedit 0 --config experimental.histedit.autoverb=True
533 533 pick 6058cbb6cfd7 0 one
534 534 roll 4f34d0f8b5fa 2 roll! one
535 535 pick 579e40513370 1 two
536 536
537 537 # Edit history between 6058cbb6cfd7 and 4f34d0f8b5fa
538 538 #
539 539 # Commits are listed from least to most recent
540 540 #
541 541 # You can reorder changesets by reordering the lines
542 542 #
543 543 # Commands:
544 544 #
545 545 # e, edit = use commit, but stop for amending
546 546 # m, mess = edit commit message without changing commit content
547 547 # p, pick = use commit
548 548 # b, base = checkout changeset and apply further changesets from there
549 549 # d, drop = remove commit from history
550 550 # f, fold = use commit, but combine it with the one above
551 551 # r, roll = like fold, but discard this commit's description and date
552 552 #
553 553
554 554 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now