##// END OF EJS Templates
tests: fix bashism to load helpers.sh...
Yuya Nishihara -
r11208:2313dc4d default
parent child Browse files
Show More
@@ -1,34 +1,34 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "rebase=" >> $HGRCPATH
7 7 echo "bookmarks=" >> $HGRCPATH
8 8
9 9 echo % initialize repository
10 10 hg init
11 11
12 12 echo 'a' > a
13 13 hg ci -A -m "0"
14 14
15 15 echo 'b' > b
16 16 hg ci -A -m "1"
17 17
18 18 hg up 0
19 19 echo 'c' > c
20 20 hg ci -A -m "2"
21 21
22 22 echo 'd' > d
23 23 hg ci -A -m "3"
24 24
25 25 hg bookmark -r 1 one
26 26 hg bookmark -r 3 two
27 27
28 28 echo % bookmark list
29 29 hg bookmark
30 30
31 31 echo % rebase
32 32 hg rebase -s two -d one 2>&1 | cleanrebase
33 33
34 34 hg log
@@ -1,45 +1,45 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4 echo "[extensions]" >> $HGRCPATH
5 5 echo "bookmarks=" >> $HGRCPATH
6 6 echo "mq=" >> $HGRCPATH
7 7
8 8 hg init
9 9
10 10 echo qqq>qqq.txt
11 11
12 12 echo % add file
13 13 hg add
14 14
15 15 echo % commit first revision
16 16 hg ci -m 1 -u user -d "1 0"
17 17
18 18 echo % set bookmark
19 19 hg book test
20 20
21 21 echo www>>qqq.txt
22 22
23 23 echo % commit second revision
24 24 hg ci -m 2 -u usr -d "1 0"
25 25
26 26 echo % set bookmark
27 27 hg book test2
28 28
29 29 echo % update to -2
30 30 hg update -r -2
31 31
32 32 echo eee>>qqq.txt
33 33
34 34 echo % commit new head
35 35 hg ci -m 3 -u user -d "1 0"
36 36
37 37 echo % bookmarks updated?
38 38 hg book
39 39
40 40 echo % strip to revision 1
41 41 hg strip 1 | hidebackup
42 42
43 43 echo % list bookmarks
44 44 hg book
45 45
@@ -1,622 +1,622 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 checkundo()
6 6 {
7 7 if [ -f .hg/store/undo ]; then
8 8 echo ".hg/store/undo still exists after $1"
9 9 fi
10 10 }
11 11
12 12 echo "[extensions]" >> $HGRCPATH
13 13 echo "mq=" >> $HGRCPATH
14 14
15 15 echo "[mq]" >> $HGRCPATH
16 16 echo "plain=true" >> $HGRCPATH
17 17
18 18 echo % help
19 19 hg help mq
20 20
21 21 hg init a
22 22 cd a
23 23 echo a > a
24 24 hg ci -Ama
25 25
26 26 hg clone . ../k
27 27
28 28 mkdir b
29 29 echo z > b/z
30 30 hg ci -Ama
31 31
32 32 echo % qinit
33 33
34 34 hg qinit
35 35
36 36 cd ..
37 37 hg init b
38 38
39 39 echo % -R qinit
40 40
41 41 hg -R b qinit
42 42
43 43 hg init c
44 44
45 45 echo % qinit -c
46 46
47 47 hg --cwd c qinit -c
48 48 hg -R c/.hg/patches st
49 49
50 50 echo '% qinit; qinit -c'
51 51 hg init d
52 52 cd d
53 53 hg qinit
54 54 hg qinit -c
55 55 # qinit -c should create both files if they don't exist
56 56 echo ' .hgignore:'
57 57 cat .hg/patches/.hgignore
58 58 echo ' series:'
59 59 cat .hg/patches/series
60 60 hg qinit -c 2>&1 | sed -e 's/repository.*already/repository already/'
61 61 cd ..
62 62
63 63 echo '% qinit; <stuff>; qinit -c'
64 64 hg init e
65 65 cd e
66 66 hg qnew A
67 67 checkundo qnew
68 68 echo foo > foo
69 69 hg add foo
70 70 hg qrefresh
71 71 hg qnew B
72 72 echo >> foo
73 73 hg qrefresh
74 74 echo status >> .hg/patches/.hgignore
75 75 echo bleh >> .hg/patches/.hgignore
76 76 hg qinit -c
77 77 hg -R .hg/patches status
78 78 # qinit -c shouldn't touch these files if they already exist
79 79 echo ' .hgignore:'
80 80 cat .hg/patches/.hgignore
81 81 echo ' series:'
82 82 cat .hg/patches/series
83 83 cd ..
84 84
85 85 echo '% init --mq without repo'
86 86 mkdir f
87 87 cd f
88 88 hg init --mq
89 89 cd ..
90 90
91 91 echo '% init --mq with repo path'
92 92 hg init g
93 93 hg init --mq g
94 94 test -d g/.hg/patches/.hg && echo "ok" || echo "failed"
95 95
96 96 echo '% init --mq with nonexistent directory'
97 97 hg init --mq nonexistentdir
98 98
99 99 echo '% init --mq with bundle (non "local")'
100 100 hg -R a bundle --all a.bundle >/dev/null
101 101 hg init --mq a.bundle
102 102
103 103 cd a
104 104
105 105 hg qnew -m 'foo bar' test.patch
106 106
107 107 echo % qrefresh
108 108
109 109 echo a >> a
110 110 hg qrefresh
111 111 sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
112 112 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
113 113 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch
114 114
115 115 echo % empty qrefresh
116 116
117 117 hg qrefresh -X a
118 118 echo 'revision:'
119 119 hg diff -r -2 -r -1
120 120 echo 'patch:'
121 121 cat .hg/patches/test.patch
122 122 echo 'working dir diff:'
123 123 hg diff --nodates -q
124 124 # restore things
125 125 hg qrefresh
126 126 checkundo qrefresh
127 127
128 128 echo % qpop
129 129
130 130 hg qpop
131 131 checkundo qpop
132 132
133 133 echo % qpush with dump of tag cache
134 134
135 135 # Dump the tag cache to ensure that it has exactly one head after qpush.
136 136 rm -f .hg/tags.cache
137 137 hg tags > /dev/null
138 138 echo ".hg/tags.cache (pre qpush):"
139 139 sed 's/ [0-9a-f]*//' .hg/tags.cache
140 140 hg qpush
141 141 hg tags > /dev/null
142 142 echo ".hg/tags.cache (post qpush):"
143 143 sed 's/ [0-9a-f]*//' .hg/tags.cache
144 144
145 145 checkundo qpush
146 146
147 147 cd ..
148 148
149 149 echo % pop/push outside repo
150 150
151 151 hg -R a qpop
152 152 hg -R a qpush
153 153
154 154 cd a
155 155 hg qnew test2.patch
156 156
157 157 echo % qrefresh in subdir
158 158
159 159 cd b
160 160 echo a > a
161 161 hg add a
162 162 hg qrefresh
163 163
164 164 echo % pop/push -a in subdir
165 165
166 166 hg qpop -a
167 167 hg --traceback qpush -a
168 168
169 169 # setting columns & interactive tests truncating (issue1912)
170 170 echo % qseries
171 171 COLUMNS=4 hg qseries --config ui.interactive=true
172 172 COLUMNS=20 hg qseries --config ui.interactive=true -vs
173 173 hg qpop
174 174 hg qseries -vs
175 175 hg sum | grep mq
176 176 hg qpush
177 177 hg sum | grep mq
178 178
179 179 echo % qapplied
180 180 hg qapplied
181 181
182 182 echo % qtop
183 183 hg qtop
184 184
185 185 echo % prev
186 186 hg qapp -1
187 187
188 188 echo % next
189 189 hg qunapp -1
190 190
191 191 hg qpop
192 192 echo % commit should fail
193 193 hg commit
194 194
195 195 echo % push should fail
196 196 hg push ../../k
197 197
198 198 echo % import should fail
199 199 hg st .
200 200 echo foo >> ../a
201 201 hg diff > ../../import.diff
202 202 hg revert --no-backup ../a
203 203 hg import ../../import.diff
204 204 hg st
205 205 echo % import --no-commit should succeed
206 206 hg import --no-commit ../../import.diff
207 207 hg st
208 208 hg revert --no-backup ../a
209 209
210 210 echo % qunapplied
211 211 hg qunapplied
212 212
213 213 echo % qpush/qpop with index
214 214 hg qnew test1b.patch
215 215 echo 1b > 1b
216 216 hg add 1b
217 217 hg qrefresh
218 218 hg qpush 2
219 219 hg qpop 0
220 220 hg qpush test.patch+1
221 221 hg qpush test.patch+2
222 222 hg qpop test2.patch-1
223 223 hg qpop test2.patch-2
224 224 hg qpush test1b.patch+1
225 225
226 226 echo % qpush --move
227 227 hg qpop -a
228 228 hg qpush --move test2.patch # move to front
229 229 hg qpush --move test1b.patch
230 230 hg qpush --move test.patch # noop move
231 231 hg qseries -v
232 232 hg qpop -a
233 233 hg qpush --move test.patch # cleaning up
234 234 hg qpush --move test1b.patch
235 235 hg qpush --move bogus # nonexistent patch
236 236 hg qpush --move test.patch # already applied
237 237 hg qpush
238 238
239 239 echo % pop, qapplied, qunapplied
240 240 hg qseries -v
241 241 echo % qapplied -1 test.patch
242 242 hg qapplied -1 test.patch
243 243 echo % qapplied -1 test1b.patch
244 244 hg qapplied -1 test1b.patch
245 245 echo % qapplied -1 test2.patch
246 246 hg qapplied -1 test2.patch
247 247 echo % qapplied -1
248 248 hg qapplied -1
249 249 echo % qapplied
250 250 hg qapplied
251 251 echo % qapplied test1b.patch
252 252 hg qapplied test1b.patch
253 253 echo % qunapplied -1
254 254 hg qunapplied -1
255 255 echo % qunapplied
256 256 hg qunapplied
257 257 echo % popping
258 258 hg qpop
259 259 echo % qunapplied -1
260 260 hg qunapplied -1
261 261 echo % qunapplied
262 262 hg qunapplied
263 263 echo % qunapplied test2.patch
264 264 hg qunapplied test2.patch
265 265 echo % qunapplied -1 test2.patch
266 266 hg qunapplied -1 test2.patch
267 267 echo % popping -a
268 268 hg qpop -a
269 269 echo % qapplied
270 270 hg qapplied
271 271 echo % qapplied -1
272 272 hg qapplied -1
273 273 hg qpush
274 274
275 275 echo % push should succeed
276 276 hg qpop -a
277 277 hg push ../../k
278 278
279 279 echo % qpush/qpop error codes
280 280 errorcode()
281 281 {
282 282 hg "$@" && echo " $@ succeeds" || echo " $@ fails"
283 283 }
284 284
285 285 # we want to start with some patches applied
286 286 hg qpush -a
287 287 echo " % pops all patches and succeeds"
288 288 errorcode qpop -a
289 289 echo " % does nothing and succeeds"
290 290 errorcode qpop -a
291 291 echo " % fails - nothing else to pop"
292 292 errorcode qpop
293 293 echo " % pushes a patch and succeeds"
294 294 errorcode qpush
295 295 echo " % pops a patch and succeeds"
296 296 errorcode qpop
297 297 echo " % pushes up to test1b.patch and succeeds"
298 298 errorcode qpush test1b.patch
299 299 echo " % does nothing and succeeds"
300 300 errorcode qpush test1b.patch
301 301 echo " % does nothing and succeeds"
302 302 errorcode qpop test1b.patch
303 303 echo " % fails - can't push to this patch"
304 304 errorcode qpush test.patch
305 305 echo " % fails - can't pop to this patch"
306 306 errorcode qpop test2.patch
307 307 echo " % pops up to test.patch and succeeds"
308 308 errorcode qpop test.patch
309 309 echo " % pushes all patches and succeeds"
310 310 errorcode qpush -a
311 311 echo " % does nothing and succeeds"
312 312 errorcode qpush -a
313 313 echo " % fails - nothing else to push"
314 314 errorcode qpush
315 315 echo " % does nothing and succeeds"
316 316 errorcode qpush test2.patch
317 317
318 318
319 319 echo % strip
320 320 cd ../../b
321 321 echo x>x
322 322 hg ci -Ama
323 323 hg strip tip | hidebackup
324 324 hg unbundle .hg/strip-backup/*
325 325
326 326 echo % strip with local changes, should complain
327 327 hg up
328 328 echo y>y
329 329 hg add y
330 330 hg strip tip | hidebackup
331 331 echo % --force strip with local changes
332 332 hg strip -f tip | hidebackup
333 333
334 334 echo '% cd b; hg qrefresh'
335 335 hg init refresh
336 336 cd refresh
337 337 echo a > a
338 338 hg ci -Ama
339 339 hg qnew -mfoo foo
340 340 echo a >> a
341 341 hg qrefresh
342 342 mkdir b
343 343 cd b
344 344 echo f > f
345 345 hg add f
346 346 hg qrefresh
347 347 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
348 348 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
349 349 echo % hg qrefresh .
350 350 hg qrefresh .
351 351 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
352 352 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
353 353 hg status
354 354
355 355 echo % qpush failure
356 356 cd ..
357 357 hg qrefresh
358 358 hg qnew -mbar bar
359 359 echo foo > foo
360 360 echo bar > bar
361 361 hg add foo bar
362 362 hg qrefresh
363 363 hg qpop -a
364 364 echo bar > foo
365 365 hg qpush -a
366 366 hg st
367 367
368 368 echo % mq tags
369 369 hg log --template '{rev} {tags}\n' -r qparent:qtip
370 370
371 371 echo % bad node in status
372 372 hg qpop
373 373 hg strip -qn tip
374 374 hg tip 2>&1 | sed -e 's/unknown node .*/unknown node/'
375 375 hg branches 2>&1 | sed -e 's/unknown node .*/unknown node/'
376 376 hg qpop 2>&1 | sed -e 's/unknown node .*/unknown node/'
377 377
378 378 cat >>$HGRCPATH <<EOF
379 379 [diff]
380 380 git = True
381 381 EOF
382 382 cd ..
383 383 hg init git
384 384 cd git
385 385 hg qinit
386 386
387 387 hg qnew -m'new file' new
388 388 echo foo > new
389 389 chmod +x new
390 390 hg add new
391 391 hg qrefresh
392 392 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
393 393 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new
394 394
395 395 hg qnew -m'copy file' copy
396 396 hg cp new copy
397 397 hg qrefresh
398 398 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
399 399 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy
400 400
401 401 hg qpop
402 402 hg qpush
403 403 hg qdiff
404 404 cat >>$HGRCPATH <<EOF
405 405 [diff]
406 406 git = False
407 407 EOF
408 408 hg qdiff --git
409 409 cd ..
410 410
411 411 echo % test file addition in slow path
412 412 hg init slow
413 413 cd slow
414 414 hg qinit
415 415 echo foo > foo
416 416 hg add foo
417 417 hg ci -m 'add foo'
418 418 hg qnew bar
419 419 echo bar > bar
420 420 hg add bar
421 421 hg mv foo baz
422 422 hg qrefresh --git
423 423 hg up -C 0
424 424 echo >> foo
425 425 hg ci -m 'change foo'
426 426 hg up -C 1
427 427 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
428 428 cat .hg/patches/bar
429 429 hg log -v --template '{rev} {file_copies}\n' -r .
430 430 hg qrefresh --git
431 431 cat .hg/patches/bar
432 432 hg log -v --template '{rev} {file_copies}\n' -r .
433 433 hg qrefresh
434 434 grep 'diff --git' .hg/patches/bar
435 435
436 436 echo % test file move chains in the slow path
437 437 hg up -C 1
438 438 echo >> foo
439 439 hg ci -m 'change foo again'
440 440 hg up -C 2
441 441 hg mv bar quux
442 442 hg mv baz bleh
443 443 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
444 444 cat .hg/patches/bar
445 445 hg log -v --template '{rev} {file_copies}\n' -r .
446 446 hg mv quux fred
447 447 hg mv bleh barney
448 448 hg qrefresh --git
449 449 cat .hg/patches/bar
450 450 hg log -v --template '{rev} {file_copies}\n' -r .
451 451
452 452 echo % refresh omitting an added file
453 453 hg qnew baz
454 454 echo newfile > newfile
455 455 hg add newfile
456 456 hg qrefresh
457 457 hg st -A newfile
458 458 hg qrefresh -X newfile
459 459 hg st -A newfile
460 460 hg revert newfile
461 461 rm newfile
462 462 hg qpop
463 463 hg qdel baz
464 464
465 465 echo % create a git patch
466 466 echo a > alexander
467 467 hg add alexander
468 468 hg qnew -f --git addalexander
469 469 grep diff .hg/patches/addalexander
470 470
471 471 echo % create a git binary patch
472 472 cat > writebin.py <<EOF
473 473 import sys
474 474 path = sys.argv[1]
475 475 open(path, 'wb').write('BIN\x00ARY')
476 476 EOF
477 477 python writebin.py bucephalus
478 478
479 479 python "$TESTDIR/md5sum.py" bucephalus
480 480 hg add bucephalus
481 481 hg qnew -f --git addbucephalus
482 482 grep diff .hg/patches/addbucephalus
483 483
484 484 echo % check binary patches can be popped and pushed
485 485 hg qpop
486 486 test -f bucephalus && echo % bucephalus should not be there
487 487 hg qpush
488 488 test -f bucephalus || echo % bucephalus should be there
489 489 python "$TESTDIR/md5sum.py" bucephalus
490 490
491 491
492 492 echo '% strip again'
493 493 cd ..
494 494 hg init strip
495 495 cd strip
496 496 touch foo
497 497 hg add foo
498 498 hg ci -m 'add foo'
499 499 echo >> foo
500 500 hg ci -m 'change foo 1'
501 501 hg up -C 0
502 502 echo 1 >> foo
503 503 hg ci -m 'change foo 2'
504 504 HGMERGE=true hg merge
505 505 hg ci -m merge
506 506 hg log
507 507 hg strip 1 | hidebackup
508 508 checkundo strip
509 509 hg log
510 510 cd ..
511 511
512 512 echo '% qclone'
513 513 qlog()
514 514 {
515 515 echo 'main repo:'
516 516 hg log --template ' rev {rev}: {desc}\n'
517 517 echo 'patch repo:'
518 518 hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
519 519 }
520 520 hg init qclonesource
521 521 cd qclonesource
522 522 echo foo > foo
523 523 hg add foo
524 524 hg ci -m 'add foo'
525 525 hg qinit
526 526 hg qnew patch1
527 527 echo bar >> foo
528 528 hg qrefresh -m 'change foo'
529 529 cd ..
530 530
531 531 # repo with unversioned patch dir
532 532 hg qclone qclonesource failure
533 533
534 534 cd qclonesource
535 535 hg qinit -c
536 536 hg qci -m checkpoint
537 537 qlog
538 538 cd ..
539 539
540 540 # repo with patches applied
541 541 hg qclone qclonesource qclonedest
542 542 cd qclonedest
543 543 qlog
544 544 cd ..
545 545
546 546 # repo with patches unapplied
547 547 cd qclonesource
548 548 hg qpop -a
549 549 qlog
550 550 cd ..
551 551 hg qclone qclonesource qclonedest2
552 552 cd qclonedest2
553 553 qlog
554 554 cd ..
555 555
556 556 echo % 'test applying on an empty file (issue 1033)'
557 557 hg init empty
558 558 cd empty
559 559 touch a
560 560 hg ci -Am addempty
561 561 echo a > a
562 562 hg qnew -f -e changea
563 563 hg qpop
564 564 hg qpush
565 565 cd ..
566 566
567 567 echo % test qpush with --force, issue1087
568 568 hg init forcepush
569 569 cd forcepush
570 570 echo hello > hello.txt
571 571 echo bye > bye.txt
572 572 hg ci -Ama
573 573 hg qnew -d '0 0' empty
574 574 hg qpop
575 575 echo world >> hello.txt
576 576
577 577 echo % qpush should fail, local changes
578 578 hg qpush
579 579
580 580 echo % apply force, should not discard changes with empty patch
581 581 hg qpush -f 2>&1 | sed 's,^.*/patch,patch,g'
582 582 hg diff --config diff.nodates=True
583 583 hg qdiff --config diff.nodates=True
584 584 hg log -l1 -p
585 585 hg qref -d '0 0'
586 586 hg qpop
587 587 echo universe >> hello.txt
588 588 echo universe >> bye.txt
589 589
590 590 echo % qpush should fail, local changes
591 591 hg qpush
592 592
593 593 echo % apply force, should discard changes in hello, but not bye
594 594 hg qpush -f
595 595 hg st
596 596 hg diff --config diff.nodates=True
597 597 hg qdiff --config diff.nodates=True
598 598
599 599 echo % test popping revisions not in working dir ancestry
600 600 hg qseries -v
601 601 hg up qparent
602 602 hg qpop
603 603
604 604 cd ..
605 605 hg init deletion-order
606 606 cd deletion-order
607 607
608 608 touch a
609 609 hg ci -Aqm0
610 610
611 611 hg qnew rename-dir
612 612 hg rm a
613 613 hg qrefresh
614 614
615 615 mkdir a b
616 616 touch a/a b/b
617 617 hg add -q a b
618 618 hg qrefresh
619 619
620 620 echo % test popping must remove files added in subdirectories first
621 621 hg qpop
622 622 cd ..
@@ -1,55 +1,55 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "mq=" >> $HGRCPATH
7 7
8 8 teststrip() {
9 9 hg up -C $1
10 10 echo % before update $1, strip $2
11 11 hg parents
12 12 hg strip $2 | hidebackup
13 13 echo % after update $1, strip $2
14 14 hg parents
15 15 hg unbundle -q .hg/strip-backup/*
16 16 rm .hg/strip-backup/*
17 17 }
18 18
19 19 hg init test
20 20 cd test
21 21
22 22 echo foo > bar
23 23 hg ci -Ama
24 24
25 25 echo more >> bar
26 26 hg ci -Amb
27 27
28 28 echo blah >> bar
29 29 hg ci -Amc
30 30
31 31 hg up 1
32 32 echo blah >> bar
33 33 hg ci -Amd
34 34
35 35 echo final >> bar
36 36 hg ci -Ame
37 37
38 38 hg log
39 39
40 40 teststrip 4 4
41 41 teststrip 4 3
42 42 teststrip 1 4
43 43 teststrip 4 2
44 44 teststrip 4 1
45 45 teststrip null 4
46 46
47 47 hg log
48 48
49 49 hg up -C 2
50 50 hg merge 4
51 51 echo % before strip of merge parent
52 52 hg parents
53 53 hg strip 4 2>&1 | hidebackup
54 54 echo % after strip of merge parent
55 55 hg parents
@@ -1,40 +1,40 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "graphlog=" >> $HGRCPATH
7 7 echo "rebase=" >> $HGRCPATH
8 8
9 9 hg init a
10 10 cd a
11 11 echo 'c1' >common
12 12 hg add common
13 13 hg commit -d '0 0' -m "C1"
14 14
15 15 echo 'c2' >>common
16 16 hg commit -d '1 0' -m "C2"
17 17
18 18 echo 'c3' >>common
19 19 hg commit -d '2 0' -m "C3"
20 20
21 21 hg update -C 1
22 22 echo 'l1' >>extra
23 23 hg add extra
24 24 hg commit -d '3 0' -m "L1"
25 25
26 26 sed -e 's/c2/l2/' common > common.new
27 27 mv common.new common
28 28 hg commit -d '4 0' -m "L2"
29 29
30 30 hg glog --template '{rev}: {desc}\n'
31 31
32 32 echo
33 33 echo '% Conflicting rebase'
34 34 hg rebase -s 3 -d 2 | cleanrebase
35 35
36 36 echo
37 37 echo '% Abort'
38 38 hg rebase --abort | cleanrebase
39 39
40 40 hg glog --template '{rev}: {desc}\n'
@@ -1,106 +1,106 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 createrepo() {
6 6 rm -rf repo
7 7 hg init repo
8 8 cd repo
9 9
10 10 echo "a" > a
11 11 hg commit -d '0 0' -A -m 'A'
12 12
13 13 hg branch branch1
14 14 hg commit -d '1 0' -m 'Branch1'
15 15
16 16 echo "b" > b
17 17 hg commit -A -d '2 0' -m 'B'
18 18
19 19 hg up 0
20 20 hg branch branch2
21 21 hg commit -d '3 0' -m 'Branch2'
22 22
23 23 echo "c" > C
24 24 hg commit -A -d '4 0' -m 'C'
25 25
26 26 hg up 2
27 27 hg branch -f branch2
28 28 echo "d" > d
29 29 hg commit -A -d '5 0' -m 'D'
30 30
31 31 echo "e" > e
32 32 hg commit -A -d '6 0' -m 'E'
33 33
34 34 hg update default
35 35
36 36 hg branch branch3
37 37 hg commit -d '7 0' -m 'Branch3'
38 38
39 39 echo "f" > f
40 40 hg commit -A -d '8 0' -m 'F'
41 41 }
42 42
43 43 echo
44 44 createrepo > /dev/null 2>&1
45 45 hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
46 46
47 47 echo
48 48 echo '% Branches'
49 49 hg branches
50 50
51 51 echo
52 52 echo '% Heads'
53 53 hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n'
54 54
55 55 echo
56 56 echo '% Rebase part of branch2 (5-6) onto branch3 (8)'
57 57 hg --config extensions.hgext.rebase= rebase --detach -s 5 -d 8 | hidebackup
58 58
59 59 echo
60 60 echo '% Branches'
61 61 hg branches
62 62
63 63 echo
64 64 echo '% Heads'
65 65 hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n'
66 66
67 67 echo
68 68 hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
69 69
70 70 echo
71 71 echo '% Rebase head of branch3 (8) onto branch2 (6)'
72 72 createrepo > /dev/null 2>&1
73 73 hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
74 74
75 75 hg --config extensions.hgext.rebase= rebase --detach -s 8 -d 6 | hidebackup
76 76
77 77 echo
78 78 echo '% Branches'
79 79 hg branches
80 80
81 81 echo
82 82 echo '% Heads'
83 83 hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n'
84 84
85 85 echo
86 86 hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
87 87 hg verify -q
88 88
89 89 echo
90 90 echo '% Rebase entire branch3 (7-8) onto branch2 (6)'
91 91 createrepo > /dev/null 2>&1
92 92 hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
93 93
94 94 hg --config extensions.hgext.rebase= rebase --detach -s 7 -d 6 | hidebackup
95 95
96 96 echo
97 97 echo '% Branches'
98 98 hg branches
99 99
100 100 echo
101 101 echo '% Heads'
102 102 hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n'
103 103
104 104 echo
105 105 hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
106 106 hg verify -q
@@ -1,70 +1,70 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "graphlog=" >> $HGRCPATH
7 7 echo "rebase=" >> $HGRCPATH
8 8
9 9 BASE=`pwd`
10 10
11 11 addcommit () {
12 12 echo $1 > $1
13 13 hg add $1
14 14 hg commit -d "${2} 0" -m $1
15 15 }
16 16
17 17 commit () {
18 18 hg commit -d "${2} 0" -m $1
19 19 }
20 20
21 21 createrepo () {
22 22 cd $BASE
23 23 rm -rf a
24 24 hg init a
25 25 cd a
26 26 addcommit "A" 0
27 27 addcommit "B" 1
28 28 echo "C" >> A
29 29 commit "C" 2
30 30
31 31 hg update -C 0
32 32 echo "D" >> A
33 33 commit "D" 3
34 34 addcommit "E" 4
35 35
36 36 hg update -C 0
37 37 hg branch 'notdefault'
38 38 echo "F" >> A
39 39 commit "F" 5
40 40 }
41 41
42 42 echo
43 43 echo "% - Rebasing B onto E - check keep"
44 44 createrepo > /dev/null 2>&1
45 45 hg glog --template '{rev}:{desc}:{branches}\n'
46 46 hg rebase -s 1 -d 4 --keep | hidebackup
47 47
48 48 echo
49 49 echo "% - Solve the conflict and go on"
50 50 echo 'conflict solved' > A
51 51 rm A.orig
52 52 hg resolve -m A
53 53 hg rebase --continue | hidebackup
54 54 hg glog --template '{rev}:{desc}:{branches}\n'
55 55
56 56 echo
57 57 echo "% - Rebase F onto E - check keepbranches"
58 58 createrepo > /dev/null 2>&1
59 59 hg glog --template '{rev}:{desc}:{branches}\n'
60 60 hg rebase -s 5 -d 4 --keepbranches | hidebackup
61 61
62 62 echo
63 63 echo "% - Solve the conflict and go on"
64 64 echo 'conflict solved' > A
65 65 rm A.orig
66 66 hg resolve -m A
67 67 hg rebase --continue 2>&1 | hidebackup
68 68 hg glog --template '{rev}:{desc}:{branches}\n'
69 69
70 70 exit 0
@@ -1,177 +1,177 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "graphlog=" >> $HGRCPATH
7 7 echo "rebase=" >> $HGRCPATH
8 8
9 9 BASE=`pwd`
10 10
11 11 addcommit () {
12 12 echo $1 > $1
13 13 hg add $1
14 14 hg commit -d "${2} 0" -m $1
15 15 }
16 16
17 17 commit () {
18 18 hg commit -d "${2} 0" -m $1
19 19 }
20 20
21 21 createrepo () {
22 22 cd $BASE
23 23 rm -rf a
24 24 hg init a
25 25 cd a
26 26 addcommit "A" 0
27 27 addcommit "B" 1
28 28 addcommit "C" 2
29 29 addcommit "D" 3
30 30
31 31 hg update -C 0
32 32 addcommit "E" 4
33 33
34 34 hg update -C 0
35 35 addcommit "F" 5
36 36
37 37 hg merge -r 4
38 38 commit "G" 6
39 39
40 40 hg update -C 5
41 41 addcommit "H" 7
42 42 }
43 43
44 44 createrepo > /dev/null 2>&1
45 45 hg glog --template '{rev}: {desc}\n'
46 46 echo '% Rebasing B onto H'
47 47 hg up -C 3
48 48 hg rebase --collapse --keepbranches | hidebackup
49 49 hg glog --template '{rev}: {desc}\n'
50 50 echo "Expected A, B, C, D, F, H"
51 51 hg manifest
52 52
53 53 createrepo > /dev/null 2>&1
54 54 echo
55 55 echo '% Rebasing G onto H'
56 56 hg rebase --base 6 --collapse | hidebackup
57 57 hg glog --template '{rev}: {desc}\n'
58 58 echo "Expected A, E, F, H"
59 59 hg manifest
60 60
61 61 createrepocomplex () {
62 62 cd $BASE
63 63 rm -rf a
64 64 hg init a
65 65 cd a
66 66 addcommit "A" 0
67 67 addcommit "B" 1
68 68
69 69 hg up 0
70 70 addcommit "C" 2
71 71 hg merge
72 72 commit "D" 3
73 73
74 74 hg up 1
75 75 addcommit "E" 4
76 76
77 77 addcommit "F" 5
78 78
79 79 hg merge
80 80 commit "G" 6
81 81
82 82 hg up 0
83 83 addcommit "H" 7
84 84 }
85 85
86 86 echo
87 87 createrepocomplex > /dev/null 2>&1
88 88 hg glog --template '{rev}: {desc}\n'
89 89
90 90 echo
91 91 echo '% Rebase and collapse - more than one external (fail)'
92 92 hg rebase -s 2 --collapse
93 93
94 94 echo
95 95 echo '% Rebase and collapse - E onto H'
96 96 hg rebase -s 4 --collapse | hidebackup
97 97 hg glog --template '{rev}: {desc}\n'
98 98 echo "Expected A, B, C, E, F, H"
99 99 hg manifest
100 100
101 101 createrepocomplex () {
102 102 cd $BASE
103 103 rm -rf a
104 104 hg init a
105 105 cd a
106 106 addcommit "A" 0
107 107 addcommit "B" 1
108 108
109 109 hg up 0
110 110 addcommit "C" 2
111 111 hg merge
112 112 commit "D" 3
113 113
114 114 hg up 1
115 115 addcommit "E" 4
116 116
117 117 echo "F" > E
118 118 commit "F" 5
119 119
120 120 addcommit "G" 6
121 121
122 122 hg merge
123 123 commit "H" 7
124 124
125 125 hg up 0
126 126 addcommit "I" 8
127 127 }
128 128
129 129 echo
130 130 createrepocomplex > /dev/null 2>&1
131 131 hg glog --template '{rev}: {desc}\n'
132 132
133 133 echo
134 134 echo '% Rebase and collapse - E onto I'
135 135 hg rebase -s 4 --collapse | hidebackup
136 136
137 137 hg glog --template '{rev}: {desc}\n'
138 138
139 139 echo "Expected A, B, C, E, G, I"
140 140 hg manifest
141 141
142 142 echo 'Cat E:'
143 143 cat E
144 144
145 145 createrepocomplex () {
146 146 cd $BASE
147 147 rm -rf a
148 148 hg init a
149 149 cd a
150 150 addcommit "A" 0
151 151 addcommit "B" 1
152 152
153 153 addcommit "C" 2
154 154 hg up 1
155 155
156 156 addcommit "D" 3
157 157
158 158 hg merge
159 159 commit "E" 4
160 160
161 161 hg up 0
162 162 addcommit "F" 5
163 163 }
164 164
165 165 echo
166 166 createrepocomplex > /dev/null 2>&1
167 167 hg glog --template '{rev}: {desc}\n'
168 168
169 169 echo
170 170 echo '% Rebase and collapse - B onto F'
171 171 hg rebase -s 1 --collapse | hidebackup
172 172
173 173 hg glog --template '{rev}: {desc}\n'
174 174
175 175 echo "Expected A, B, C, D, F"
176 176 hg manifest
177 177 exit 0
@@ -1,74 +1,74 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "graphlog=" >> $HGRCPATH
7 7 echo "rebase=" >> $HGRCPATH
8 8
9 9 hg init a
10 10 cd a
11 11 echo 'c1' >common
12 12 hg add common
13 13 hg commit -d '0 0' -m "C1"
14 14
15 15 echo 'c2' >>common
16 16 hg commit -d '1 0' -m "C2"
17 17
18 18 echo 'c3' >>common
19 19 hg commit -d '2 0' -m "C3"
20 20
21 21 hg update -C 1
22 22 echo 'l1' >>extra
23 23 hg add extra
24 24 hg commit -d '3 0' -m "L1"
25 25
26 26 sed -e 's/c2/l2/' common > common.new
27 27 mv common.new common
28 28 hg commit -d '4 0' -m "L2"
29 29
30 30 echo 'l3' >> extra2
31 31 hg add extra2
32 32 hg commit -d '5 0' -m "L3"
33 33
34 34 hg glog --template '{rev}: {desc}\n'
35 35
36 36 echo
37 37 echo '% Try to call --continue'
38 38 hg rebase --continue
39 39
40 40 echo
41 41 echo '% Conflicting rebase'
42 42 hg rebase -s 3 -d 2
43 43
44 44 echo
45 45 echo '% Try to continue without solving the conflict'
46 46 hg rebase --continue
47 47
48 48 echo
49 49 echo '% Conclude rebase'
50 50 echo 'resolved merge' >common
51 51 hg resolve -m common
52 52 hg rebase --continue | cleanrebase
53 53
54 54 hg glog --template '{rev}: {desc}\n'
55 55
56 56 echo
57 57 echo '% Check correctness'
58 58 echo ' - Rev. 0'
59 59 hg cat -r 0 common
60 60
61 61 echo ' - Rev. 1'
62 62 hg cat -r 1 common
63 63
64 64 echo ' - Rev. 2'
65 65 hg cat -r 2 common
66 66
67 67 echo ' - Rev. 3'
68 68 hg cat -r 3 common
69 69
70 70 echo ' - Rev. 4'
71 71 hg cat -r 4 common
72 72
73 73 echo ' - Rev. 5'
74 74 hg cat -r 5 common
@@ -1,70 +1,70 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "graphlog=" >> $HGRCPATH
7 7 echo "rebase=" >> $HGRCPATH
8 8
9 9 BASE=`pwd`
10 10
11 11 addcommit () {
12 12 echo $1 > $1
13 13 hg add $1
14 14 hg commit -d "${2} 0" -m $1
15 15 }
16 16
17 17 commit () {
18 18 hg commit -d "${2} 0" -m $1
19 19 }
20 20
21 21 createrepo () {
22 22 cd $BASE
23 23 rm -rf a
24 24 hg init a
25 25 cd a
26 26 addcommit "A" 0
27 27 addcommit "B" 1
28 28 addcommit "C" 2
29 29 addcommit "D" 3
30 30
31 31 hg update -C 0
32 32 addcommit "E" 4
33 33 }
34 34
35 35 createrepo > /dev/null 2>&1
36 36 hg glog --template '{rev}: {desc}\n'
37 37 echo '% Rebasing D onto E detaching from C'
38 38 hg rebase --detach -s 3 -d 4 | hidebackup
39 39 hg glog --template '{rev}: {desc}\n'
40 40 echo "Expected A, D, E"
41 41 hg manifest
42 42
43 43 echo
44 44 createrepo > /dev/null 2>&1
45 45 hg glog --template '{rev}: {desc}\n'
46 46 echo '% Rebasing C onto E detaching from B'
47 47 hg rebase --detach -s 2 -d 4 | hidebackup
48 48 hg glog --template '{rev}: {desc}\n'
49 49 echo "Expected A, C, D, E"
50 50 hg manifest
51 51
52 52 echo
53 53 createrepo > /dev/null 2>&1
54 54 hg glog --template '{rev}: {desc}\n'
55 55 echo '% Rebasing B onto E using detach (same as not using it)'
56 56 hg rebase --detach -s 1 -d 4 | hidebackup
57 57 hg glog --template '{rev}: {desc}\n'
58 58 echo "Expected A, B, C, D, E"
59 59 hg manifest
60 60
61 61 echo
62 62 createrepo > /dev/null 2>&1
63 63 hg glog --template '{rev}: {desc}\n'
64 64 echo '% Rebasing C onto E detaching from B and collapsing'
65 65 hg rebase --detach --collapse -s 2 -d 4 | hidebackup
66 66 hg glog --template '{rev}: {desc}\n'
67 67 echo "Expected A, C, D, E"
68 68 hg manifest
69 69
70 70 exit 0
@@ -1,83 +1,83 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4 echo "[extensions]" >> $HGRCPATH
5 5 echo "graphlog=" >> $HGRCPATH
6 6 echo "rebase=" >> $HGRCPATH
7 7
8 8 BASE=`pwd`
9 9
10 10 addcommit () {
11 11 echo $1 > $1
12 12 hg add $1
13 13 hg commit -d "${2} 0" -m $1
14 14 }
15 15
16 16 commit () {
17 17 hg commit -d "${2} 0" -m $1
18 18 }
19 19
20 20 createrepo () {
21 21 cd $BASE
22 22 rm -rf a
23 23 hg init a
24 24 cd a
25 25 addcommit "A" 0
26 26 addcommit "B" 1
27 27 echo "C" >> A
28 28 commit "C" 2
29 29
30 30 hg update -C 0
31 31 echo "D" >> A
32 32 commit "D" 3
33 33 addcommit "E" 4
34 34 }
35 35
36 36 echo "% Changes during an interruption - continue"
37 37 createrepo > /dev/null 2>&1
38 38 hg glog --template '{rev}: {desc}\n'
39 39
40 40 echo
41 41 echo "% - Rebasing B onto E"
42 42 hg rebase -s 1 -d 4 | hidebackup
43 43
44 44 echo
45 45 echo "% - Force a commit on C during the interruption"
46 46 hg update -C 2
47 47 addcommit "Extra" 5
48 48 hg glog --template '{rev}: {desc}\n'
49 49
50 50 echo
51 51 echo "% - Resume the rebasing"
52 52 hg rebase --continue
53 53
54 54 echo
55 55 echo "% - Solve the conflict and go on"
56 56 echo 'conflict solved' > A
57 57 rm A.orig
58 58 hg resolve -m A
59 59 hg rebase --continue
60 60 hg glog --template '{rev}: {desc}\n'
61 61
62 62 echo
63 63 echo
64 64 echo "% Changes during an interruption - abort"
65 65 createrepo > /dev/null 2>&1
66 66 hg glog --template '{rev}: {desc}\n'
67 67
68 68 echo
69 69 echo "% Rebasing B onto E"
70 70 hg rebase -s 1 -d 4 | hidebackup
71 71
72 72 echo
73 73 echo "% Force a commit on B' during the interruption"
74 74 hg update -C 5
75 75 addcommit "Extra" 6
76 76 hg glog --template '{rev}: {desc}\n'
77 77
78 78 echo
79 79 echo "% Abort the rebasing"
80 80 hg rebase --abort
81 81 hg glog --template '{rev}: {desc}\n'
82 82
83 83 exit 0
@@ -1,51 +1,51 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "graphlog=" >> $HGRCPATH
7 7 echo "rebase=" >> $HGRCPATH
8 8
9 9 addcommit () {
10 10 echo $1 > $1
11 11 hg add $1
12 12 hg commit -d "${2} 0" -m $1
13 13 }
14 14
15 15 hg init a
16 16 cd a
17 17 addcommit "c1" 0
18 18 addcommit "c2" 1
19 19
20 20 addcommit "l1" 2
21 21
22 22 hg update -C 1
23 23 addcommit "r1" 3
24 24 addcommit "r2" 4
25 25 hg glog --template '{rev}:{desc}\n'
26 26
27 27 echo
28 28 echo '% Rebase with no arguments - single revision in source branch'
29 29 hg update -C 2
30 30 hg rebase | hidebackup
31 31 hg glog --template '{rev}:{desc}\n'
32 32
33 33 cd ..
34 34 rm -rf a
35 35 hg init a
36 36 cd a
37 37 addcommit "c1" 0
38 38 addcommit "c2" 1
39 39
40 40 addcommit "l1" 2
41 41 addcommit "l2" 3
42 42
43 43 hg update -C 1
44 44 addcommit "r1" 4
45 45 hg glog --template '{rev}:{desc}\n'
46 46
47 47 echo
48 48 echo '% Rebase with no arguments - single revision in target branch'
49 49 hg update -C 3
50 50 hg rebase 2>&1 | hidebackup
51 51 hg glog --template '{rev}:{desc}\n'
@@ -1,123 +1,123 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "graphlog=" >> $HGRCPATH
7 7 echo "rebase=" >> $HGRCPATH
8 8 echo "mq=" >> $HGRCPATH
9 9
10 10 echo "[mq]" >> $HGRCPATH
11 11 echo "plain=true" >> $HGRCPATH
12 12
13 13 filterpatch()
14 14 {
15 15 sed -e "s/^\(# Date\).*/\1/" \
16 16 -e "s/^\(# Node ID\).*/\1/" \
17 17 -e "s/^\(# Parent\).*/\1/" \
18 18 -e "s/^\(diff -r \)\([a-f0-9]* \)\(-r \)\([a-f0-9]* \)/\1x \3y /" \
19 19 -e "s/^\(diff -r \)\([a-f0-9]* \)/\1x /" \
20 20 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" \
21 21 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/"
22 22 }
23 23
24 24 hg init a
25 25 cd a
26 26 hg qinit -c # This must work even with a managed mq queue
27 27
28 28 echo 'c1' > f
29 29 hg add f
30 30 hg commit -d '0 0' -m "C1"
31 31
32 32 echo 'r1' > f
33 33 hg commit -d '2 0' -m "R1"
34 34
35 35 hg up 0
36 36 hg qnew f.patch
37 37 echo 'mq1' > f
38 38 hg qref -m 'P0'
39 39
40 40 hg qnew f2.patch
41 41 echo 'mq2' > f
42 42 hg qref -m 'P1'
43 43 hg glog --template '{rev} {desc} tags: {tags}\n'
44 44
45 45 echo
46 46 echo '% Rebase - try to rebase on an applied mq patch'
47 47 hg rebase -s 1 -d 3
48 48
49 49 echo
50 50 echo '% Rebase - same thing, but mq patch is default dest'
51 51 hg update -q 1
52 52 hg rebase
53 53 hg update -q qtip
54 54
55 55 echo
56 56 echo '% Rebase - generate a conflict'
57 57 hg rebase -s 2 -d 1
58 58
59 59 echo
60 60 echo '% Fix the 1st conflict'
61 61 echo 'mq1r1' > f
62 62 hg resolve -m f
63 63 hg rebase -c | hidebackup
64 64
65 65 echo
66 66 echo '% Fix the 2nd conflict'
67 67 echo 'mq1r1mq2' > f
68 68 hg resolve -m f
69 69 hg rebase -c | hidebackup
70 70
71 71 hg glog --template '{rev} {desc} tags: {tags}\n'
72 72
73 73 echo
74 74 echo '% Update to qbase'
75 75 hg up qbase
76 76 echo '% f correctly reflects the merge result'
77 77 cat f
78 78 echo '% And the patch is correct'
79 79 cat .hg/patches/f.patch | filterpatch
80 80
81 81 echo
82 82 echo '% Update to qtip'
83 83 hg up qtip
84 84 echo '% f correctly reflects the merge result'
85 85 cat f
86 86 echo '% And the patch is correct'
87 87 cat .hg/patches/f2.patch | filterpatch
88 88
89 89 echo
90 90 echo '% Adding one git-style patch and one normal'
91 91 hg qpop -a
92 92 rm -fr .hg/patches
93 93 hg qinit -c
94 94
95 95 hg up 0
96 96 hg qnew --git f_git.patch
97 97 echo 'mq1' > p
98 98 hg add p
99 99 hg qref --git -m 'P0 (git)'
100 100
101 101 hg qnew f.patch
102 102 echo 'mq2' > p
103 103 hg qref -m 'P1'
104 104
105 105 echo '% Git patch'
106 106 cat .hg/patches/f_git.patch | filterpatch
107 107
108 108 echo
109 109 echo '% Normal patch'
110 110 cat .hg/patches/f.patch | filterpatch
111 111
112 112 echo
113 113 echo '% Rebase the applied mq patches'
114 114 hg rebase -s 2 -d 1 --quiet
115 115
116 116 echo '% And the patches are correct'
117 117 echo '% Git patch'
118 118 cat .hg/patches/f_git.patch | filterpatch
119 119
120 120 echo
121 121 echo '% Normal patch'
122 122 cat .hg/patches/f.patch | filterpatch
123 123
@@ -1,46 +1,46 b''
1 1 #!/bin/sh
2 2 # This emulates the effects of an hg pull --rebase in which the remote repo
3 3 # already has one local mq patch
4 4
5 source $TESTDIR/helpers.sh
5 . $TESTDIR/helpers.sh
6 6
7 7 echo "[extensions]" >> $HGRCPATH
8 8 echo "graphlog=" >> $HGRCPATH
9 9 echo "rebase=" >> $HGRCPATH
10 10 echo "mq=" >> $HGRCPATH
11 11
12 12 hg init a
13 13 cd a
14 14 hg qinit -c # This must work even with a managed mq queue
15 15
16 16 echo 'c1' > c1
17 17 hg add c1
18 18 hg commit -d '0 0' -m "C1"
19 19
20 20 echo 'r1' > r1
21 21 hg add r1
22 22 hg commit -d '1 0' -m "R1"
23 23
24 24 hg up 0
25 25 hg qnew p0.patch
26 26 echo 'p0' > p0
27 27 hg add p0
28 28 hg qref -m 'P0'
29 29
30 30 hg qnew p1.patch
31 31 echo 'p1' > p1
32 32 hg add p1
33 33 hg qref -m 'P1'
34 34 hg export qtip > p1.patch
35 35
36 36 echo
37 37 echo '% "Mainstream" import p1.patch'
38 38 hg up -C 1
39 39 hg import p1.patch
40 40 rm p1.patch
41 41
42 42 echo
43 43 echo '% Rebase'
44 44 hg up -C qtip
45 45 hg rebase | hidebackup
46 46 hg glog --template '{rev} {desc} tags: {tags}\n'
@@ -1,33 +1,33 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "graphlog=" >> $HGRCPATH
7 7 echo "rebase=" >> $HGRCPATH
8 8
9 9 rm -rf repo
10 10 hg init repo
11 11 cd repo
12 12
13 13 echo A > a
14 14 echo >> a
15 15 hg commit -AmA -u test -d '0 0'
16 16
17 17 echo B > a
18 18 echo >> a
19 19 hg commit -mB -u test -d '1 0'
20 20
21 21 echo C > a
22 22 echo >> a
23 23 hg commit -mC -u test -d '2 0'
24 24
25 25 hg up -C 0
26 26 echo D >> a
27 27 hg commit -AmAD -u test -d '3 0'
28 28
29 29 hg glog --template '{rev}:{desc} {node|short}\n'
30 30 hg rebase -q -s 1 -d 3 | hidebackup
31 31 hg glog --template '{rev}:{desc} {node|short}\n'
32 32
33 33 exit 0
@@ -1,110 +1,110 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "rebase=" >> $HGRCPATH
7 7
8 8 addcommit () {
9 9 echo $1 > $1
10 10 hg add $1
11 11 hg commit -d "${2} 0" -m $1
12 12 }
13 13
14 14 commit () {
15 15 hg commit -d "${2} 0" -m $1
16 16 }
17 17
18 18 createrepo () {
19 19 hg init a
20 20 cd a
21 21 addcommit "c1" 0
22 22 addcommit "c2" 1
23 23 addcommit "c3" 2
24 24
25 25 hg update -C 1
26 26 addcommit "l1" 3
27 27 addcommit "l2" 4
28 28 addcommit "l3" 5
29 29
30 30 hg update -C 2
31 31 addcommit "r1" 6
32 32 addcommit "r2" 7
33 33 }
34 34
35 35 createrepo > /dev/null 2>&1
36 36 echo "% These fail"
37 37 echo
38 38 echo "% Use continue and abort"
39 39 hg rebase --continue --abort
40 40
41 41 echo
42 42 echo "% Use continue and collapse"
43 43 hg rebase --continue --collapse
44 44
45 45 echo
46 46 echo "% Use continue/abort and dest/source"
47 47 hg rebase --continue --dest 4
48 48
49 49 echo
50 50 echo "% Use source and base"
51 51 hg rebase --base 5 --source 4
52 52
53 53 echo
54 54 echo "% Rebase with no arguments - from current"
55 55 hg rebase
56 56
57 57 echo
58 58 echo "% Rebase with no arguments - from the current branch"
59 59 hg update 6
60 60 hg rebase
61 61
62 62 echo "% ----------"
63 63 echo "% These work"
64 64 echo
65 65 echo "% Rebase with no arguments (from 3 onto 7)"
66 66 hg update -C 5
67 67 hg rebase 2>&1 | hidebackup
68 68
69 69 echo "% Try to rollback after a rebase (fail)"
70 70 hg rollback
71 71
72 72 createrepo > /dev/null 2>&1
73 73 echo
74 74 echo "% Rebase with base == '.' => same as no arguments (from 3 onto 7)"
75 75 hg update -C 5
76 76 hg rebase --base . | hidebackup
77 77
78 78 createrepo > /dev/null 2>&1
79 79 echo
80 80 echo "% Rebase with dest == `hg branch` => same as no arguments (from 3 onto 7)"
81 81 hg update -C 5
82 82 hg rebase --dest `hg branch` | hidebackup
83 83
84 84 createrepo > /dev/null 2>&1
85 85 echo
86 86 echo "% Specify only source (from 4 onto 7)"
87 87 hg rebase --source 4 | hidebackup
88 88
89 89 createrepo > /dev/null 2>&1
90 90 echo
91 91 echo "% Specify only dest (from 3 onto 6)"
92 92 hg update -C 5
93 93 hg rebase --dest 6 | hidebackup
94 94
95 95 createrepo > /dev/null 2>&1
96 96 echo
97 97 echo "% Specify only base (from 3 onto 7)"
98 98 hg rebase --base 5 | hidebackup
99 99
100 100 createrepo > /dev/null 2>&1
101 101 echo
102 102 echo "% Specify source and dest (from 4 onto 6)"
103 103 hg rebase --source 4 --dest 6 | hidebackup
104 104
105 105 createrepo > /dev/null 2>&1
106 106 echo
107 107 echo "% Specify base and dest (from 3 onto 6)"
108 108 hg rebase --base 4 --dest 6 | hidebackup
109 109
110 110 exit 0
@@ -1,63 +1,63 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "graphlog=" >> $HGRCPATH
7 7 echo "rebase=" >> $HGRCPATH
8 8
9 9 addcommit () {
10 10 echo $1 > $1
11 11 hg add $1
12 12 hg commit -d "${2} 0" -m $1
13 13 }
14 14
15 15 commit () {
16 16 hg commit -d "${2} 0" -m $1
17 17 }
18 18
19 19 rm -rf a
20 20 hg init a
21 21 cd a
22 22 addcommit "C1" 0
23 23 addcommit "C2" 1
24 24
25 25 cd ..
26 26 hg clone a b
27 27 # This is needed to test pull --rebase
28 28 hg clone a c
29 29
30 30 cd b
31 31 addcommit "L1" 2
32 32
33 33 cd ../a
34 34 addcommit "R1" 3
35 35
36 36 cd ../b
37 37 echo
38 38 echo "% Now b has one revision to be pulled from a"
39 39 hg pull --rebase | hidebackup | sed -e 's/\(pulling from \).*/\1/'
40 40
41 41 hg glog --template '{rev}:{desc}\n'
42 42
43 43 echo
44 44 echo "% Re-run pull --rebase"
45 45 hg pull --rebase | sed 's/\(pulling from \).*/\1/'
46 46
47 47 echo
48 48 echo "% Invoke pull --rebase and nothing to rebase"
49 49 cd ../c
50 50 hg pull --rebase 2>&1 | sed 's/\(pulling from \).*/\1/'
51 51 hg glog --template '{rev}\n' -l 1
52 52
53 53 echo
54 54 echo "% pull --rebase --update should ignore --update"
55 55 hg pull --rebase --update 2>&1 | sed 's/\(pulling from \).*/\1/'
56 56
57 57 echo
58 58 echo "% pull --rebase doesn't update if nothing has been pulled"
59 59 hg up 1
60 60 hg pull --rebase 2>&1 | sed 's/\(pulling from \).*/\1/'
61 61 hg glog --template '{rev}\n' -l 1
62 62
63 63 exit 0
@@ -1,55 +1,55 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "rebase=" >> $HGRCPATH
7 7 echo "[diff]" >> $HGRCPATH
8 8 echo "git=1" >> $HGRCPATH
9 9
10 10 BASE=`pwd`
11 11
12 12 hg init repo1
13 13 cd repo1
14 14 echo "a">a
15 15 hg commit -Am "A" --date '0 0'
16 16 echo "b"> b
17 17 hg commit -Am "B" --date '1 0'
18 18 hg up -C 0
19 19 hg mv a a-renamed
20 20 hg commit -m 'rename A' --date '2 0'
21 21
22 22 echo
23 23 echo '% Rename is tracked'
24 24 hg log -p -r tip --template '{rev}:{desc}\n'
25 25
26 26 echo '% Rebase the revision containing the rename'
27 27 hg rebase -s 2 -d 1 --quiet | cleanrebase
28 28
29 29 echo
30 30 echo '% Rename is not lost'
31 31 hg log -p -r tip --template '{rev}:{desc}\n'
32 32
33 33 cd $BASE
34 34 rm -rf repo1
35 35 hg init repo1
36 36 cd repo1
37 37 echo "a">a
38 38 hg commit -Am "A" --date '0 0'
39 39 echo "b"> b
40 40 hg commit -Am "B" --date '1 0'
41 41 hg up -C 0
42 42 hg cp a a-copied
43 43 hg commit -m 'copy A' --date '2 0'
44 44
45 45 echo
46 46 echo '% Copy is tracked'
47 47 hg log -p -r tip --template '{rev}:{desc}\n'
48 48
49 49 echo '% Rebase the revision containing the copy'
50 50 hg rebase -s 2 -d 1 --quiet | cleanrebase
51 51
52 52 echo
53 53 echo '% Copy is not lost'
54 54 hg log -p -r tip --template '{rev}:{desc}\n'
55 55
@@ -1,93 +1,93 b''
1 1 #!/bin/sh
2 2
3 source $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4 4
5 5 echo "[extensions]" >> $HGRCPATH
6 6 echo "graphlog=" >> $HGRCPATH
7 7 echo "rebase=" >> $HGRCPATH
8 8
9 9 BASE=`pwd`
10 10
11 11 addcommit () {
12 12 echo $1 > $1
13 13 hg add $1
14 14 hg commit -d "${2} 0" -m $1
15 15 }
16 16
17 17 commit () {
18 18 hg commit -d "${2} 0" -m $1
19 19 }
20 20
21 21 createrepo () {
22 22 cd $BASE
23 23 rm -rf a
24 24 hg init a
25 25 cd a
26 26 addcommit "A" 0
27 27 addcommit "B" 1
28 28
29 29 hg update -C 0
30 30 addcommit "C" 2
31 31
32 32 hg update -C 0
33 33 addcommit "D" 3
34 34
35 35 hg merge -r 2
36 36 commit "E" 4
37 37
38 38 hg update -C 3
39 39 addcommit "F" 5
40 40 }
41 41
42 42 createrepo > /dev/null 2>&1
43 43 hg glog --template '{rev}: {desc}\n'
44 44
45 45 echo '% Rebasing'
46 46 echo '% B onto F - simple rebase'
47 47 hg rebase -s 1 -d 5 | hidebackup
48 48 hg glog --template '{rev}: {desc}\n'
49 49
50 50 createrepo > /dev/null 2>&1
51 51 echo '% B onto D - intermediate point'
52 52 hg rebase -s 1 -d 3 | hidebackup
53 53 hg glog --template '{rev}: {desc}\n'
54 54
55 55 createrepo > /dev/null 2>&1
56 56 echo '% C onto F - skip of E'
57 57 hg rebase -s 2 -d 5 | hidebackup
58 58 hg glog --template '{rev}: {desc}\n'
59 59
60 60 createrepo > /dev/null 2>&1
61 61 echo '% D onto C - rebase of a branching point (skip E)'
62 62 hg rebase -s 3 -d 2 | hidebackup
63 63 hg glog --template '{rev}: {desc}\n'
64 64
65 65 createrepo > /dev/null 2>&1
66 66 echo '% E onto F - merged revision having a parent in ancestors of target'
67 67 hg rebase -s 4 -d 5 | hidebackup
68 68 hg glog --template '{rev}: {desc}\n'
69 69
70 70 createrepo > /dev/null 2>&1
71 71 echo '% D onto B - E maintains C as parent'
72 72 hg rebase -s 3 -d 1 | hidebackup
73 73 hg glog --template '{rev}: {desc}\n'
74 74
75 75 echo '% These will fail (using --source)'
76 76 createrepo > /dev/null 2>&1
77 77 echo '% E onto D - rebase onto an ancestor'
78 78 hg rebase -s 4 -d 3
79 79 echo '% D onto E - rebase onto a descendant'
80 80 hg rebase -s 3 -d 4
81 81 echo '% E onto B - merge revision with both parents not in ancestors of target'
82 82 hg rebase -s 4 -d 1
83 83
84 84 echo
85 85 echo '% These will abort gracefully (using --base)'
86 86 echo '% E onto E - rebase onto same changeset'
87 87 hg rebase -b 4 -d 4
88 88 echo '% E onto D - rebase onto an ancestor'
89 89 hg rebase -b 4 -d 3
90 90 echo '% D onto E - rebase onto a descendant'
91 91 hg rebase -b 3 -d 4
92 92
93 93 exit 0
@@ -1,64 +1,64 b''
1 1 #!/bin/sh
2 2
3 3 # test stripping of filelogs where the linkrev doesn't always increase
4 4
5 source $TESTDIR/helpers.sh
5 . $TESTDIR/helpers.sh
6 6 echo '[extensions]' >> $HGRCPATH
7 7 echo 'hgext.mq =' >> $HGRCPATH
8 8
9 9 hg init orig
10 10 cd orig
11 11
12 12 commit()
13 13 {
14 14 hg up -qC null
15 15 count=1
16 16 for i in "$@"; do
17 17 for f in $i; do
18 18 echo $count > $f
19 19 done
20 20 count=`expr $count + 1`
21 21 done
22 22 hg commit -qAm "$*"
23 23 }
24 24
25 25 # 2 1 0 2 0 1 2
26 26 commit '201 210'
27 27
28 28 commit '102 120' '210'
29 29
30 30 commit '021'
31 31
32 32 commit '201' '021 120'
33 33
34 34 commit '012 021' '102 201' '120 210'
35 35
36 36 commit 'manifest-file'
37 37
38 38 commit '102 120' '012 210' '021 201'
39 39
40 40 commit '201 210' '021 120' '012 102'
41 41
42 42 HGUSER=another-user; export HGUSER
43 43 commit 'manifest-file'
44 44
45 45 commit '012' 'manifest-file'
46 46
47 47 cd ..
48 48 hg clone -q -U -r -1 -r -2 -r -3 -r -4 -r -6 orig crossed
49 49
50 50 for i in crossed/.hg/store/00manifest.i crossed/.hg/store/data/*.i; do
51 51 echo $i
52 52 hg debugindex $i
53 53 echo
54 54 done
55 55
56 56 for i in 0 1 2 3 4; do
57 57 hg clone -q -U --pull crossed $i
58 58 echo "% Trying to strip revision $i"
59 59 hg --cwd $i strip $i | hidebackup
60 60 echo "% Verifying"
61 61 hg --cwd $i verify
62 62 echo
63 63 done
64 64
General Comments 0
You need to be logged in to leave comments. Login now