Mercurial > hg > mercurial-crew
diff tests/test-rebase-parameters.t @ 12605:16b854cb80f1
tests: unify test-rebase*
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Fri, 01 Oct 2010 16:10:06 +0200 |
parents | tests/test-rebase-parameters@2313dc4d9817 |
children | 6cc4b14fb76b |
line wrap: on
line diff
old mode 100755 new mode 100644 copy from tests/test-rebase-parameters copy to tests/test-rebase-parameters.t --- a/tests/test-rebase-parameters +++ b/tests/test-rebase-parameters.t @@ -1,110 +1,332 @@ -#!/bin/sh + $ cat >> $HGRCPATH <<EOF + > [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF + + + $ hg init a + $ cd a + + $ echo c1 > c1 + $ hg ci -Am c1 + adding c1 -. $TESTDIR/helpers.sh + $ echo c2 > c2 + $ hg ci -Am c2 + adding c2 + + $ echo c3 > c3 + $ hg ci -Am c3 + adding c3 -echo "[extensions]" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH + $ hg up -q -C 1 + + $ echo l1 > l1 + $ hg ci -Am l1 + adding l1 + created new head + + $ echo l2 > l2 + $ hg ci -Am l2 + adding l2 -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} + $ echo l3 > l3 + $ hg ci -Am l3 + adding l3 + + $ hg up -q -C 2 + + $ echo r1 > r1 + $ hg ci -Am r1 + adding r1 + + $ echo r2 > r2 + $ hg ci -Am r2 + adding r2 -commit () { - hg commit -d "${2} 0" -m $1 -} + $ hg tglog + @ 7: 'r2' + | + o 6: 'r1' + | + | o 5: 'l3' + | | + | o 4: 'l2' + | | + | o 3: 'l1' + | | + o | 2: 'c3' + |/ + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. -createrepo () { - hg init a - cd a - addcommit "c1" 0 - addcommit "c2" 1 - addcommit "c3" 2 + +These fail: + + $ hg clone -q -u . a a1 + $ cd a1 + + $ hg rebase --continue --abort + abort: cannot use both abort and continue + [255] - hg update -C 1 - addcommit "l1" 3 - addcommit "l2" 4 - addcommit "l3" 5 + $ hg rebase --continue --collapse + abort: cannot use collapse with continue or abort + [255] + + $ hg rebase --continue --dest 4 + abort: abort and continue do not allow specifying revisions + [255] + + $ hg rebase --base 5 --source 4 + abort: cannot specify both a revision and a base + [255] + + $ hg rebase + nothing to rebase + [1] - hg update -C 2 - addcommit "r1" 6 - addcommit "r2" 7 -} + $ hg up -q 6 + + $ hg rebase + nothing to rebase + [1] + + +These work: + +Rebase with no arguments (from 3 onto 7): + + $ hg up -q -C 5 + + $ hg rebase + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -createrepo > /dev/null 2>&1 -echo "% These fail" -echo -echo "% Use continue and abort" -hg rebase --continue --abort + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + | + o 5: 'l1' + | + o 4: 'r2' + | + o 3: 'r1' + | + o 2: 'c3' + | + o 1: 'c2' + | + o 0: 'c1' + +Try to rollback after a rebase (fail): + + $ hg rollback + no rollback information available + [1] + + $ cd .. + -echo -echo "% Use continue and collapse" -hg rebase --continue --collapse +Rebase with base == '.' => same as no arguments (from 3 onto 7): + + $ hg clone -q -u 5 a a2 + $ cd a2 + + $ hg rebase --base . + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -echo -echo "% Use continue/abort and dest/source" -hg rebase --continue --dest 4 + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + | + o 5: 'l1' + | + o 4: 'r2' + | + o 3: 'r1' + | + o 2: 'c3' + | + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. -echo -echo "% Use source and base" -hg rebase --base 5 --source 4 -echo -echo "% Rebase with no arguments - from current" -hg rebase +Rebase with dest == `hg branch` => same as no arguments (from 3 onto 7): + + $ hg clone -q -u 5 a a3 + $ cd a3 + + $ hg rebase --dest `hg branch` + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -echo -echo "% Rebase with no arguments - from the current branch" -hg update 6 -hg rebase + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + | + o 5: 'l1' + | + o 4: 'r2' + | + o 3: 'r1' + | + o 2: 'c3' + | + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. + + +Specify only source (from 4 onto 7): + + $ hg clone -q -u . a a4 + $ cd a4 + + $ hg rebase --source 4 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -echo "% ----------" -echo "% These work" -echo -echo "% Rebase with no arguments (from 3 onto 7)" -hg update -C 5 -hg rebase 2>&1 | hidebackup + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + |\ + | o 5: 'r2' + | | + | o 4: 'r1' + | | + o | 3: 'l1' + | | + | o 2: 'c3' + |/ + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. + + +Specify only dest (from 3 onto 6): -echo "% Try to rollback after a rebase (fail)" -hg rollback + $ hg clone -q -u 5 a a5 + $ cd a5 + + $ hg rebase --dest 6 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -createrepo > /dev/null 2>&1 -echo -echo "% Rebase with base == '.' => same as no arguments (from 3 onto 7)" -hg update -C 5 -hg rebase --base . | hidebackup + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + | + o 5: 'l1' + | + | o 4: 'r2' + |/ + o 3: 'r1' + | + o 2: 'c3' + | + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. + -createrepo > /dev/null 2>&1 -echo -echo "% Rebase with dest == `hg branch` => same as no arguments (from 3 onto 7)" -hg update -C 5 -hg rebase --dest `hg branch` | hidebackup +Specify only base (from 3 onto 7): + + $ hg clone -q -u . a a6 + $ cd a6 + + $ hg rebase --base 5 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -createrepo > /dev/null 2>&1 -echo -echo "% Specify only source (from 4 onto 7)" -hg rebase --source 4 | hidebackup + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + | + o 5: 'l1' + | + o 4: 'r2' + | + o 3: 'r1' + | + o 2: 'c3' + | + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. -createrepo > /dev/null 2>&1 -echo -echo "% Specify only dest (from 3 onto 6)" -hg update -C 5 -hg rebase --dest 6 | hidebackup + +Specify source and dest (from 4 onto 6): + + $ hg clone -q -u . a a7 + $ cd a7 + + $ hg rebase --source 4 --dest 6 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -createrepo > /dev/null 2>&1 -echo -echo "% Specify only base (from 3 onto 7)" -hg rebase --base 5 | hidebackup + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + |\ + | | o 5: 'r2' + | |/ + | o 4: 'r1' + | | + o | 3: 'l1' + | | + | o 2: 'c3' + |/ + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. + + +Specify base and dest (from 3 onto 6): -createrepo > /dev/null 2>&1 -echo -echo "% Specify source and dest (from 4 onto 6)" -hg rebase --source 4 --dest 6 | hidebackup + $ hg clone -q -u . a a8 + $ cd a8 + + $ hg rebase --base 4 --dest 6 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -createrepo > /dev/null 2>&1 -echo -echo "% Specify base and dest (from 3 onto 6)" -hg rebase --base 4 --dest 6 | hidebackup + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + | + o 5: 'l1' + | + | o 4: 'r2' + |/ + o 3: 'r1' + | + o 2: 'c3' + | + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. -exit 0