# HG changeset patch # User Adrian Buehlmann # Date 1285942206 -7200 # Node ID 16b854cb80f1e7bd65c6438f73180d301719f419 # Parent 1393a81b3bdcd7d4fb4ca4016febe05e36210fd4 tests: unify test-rebase* diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-abort --- a/tests/test-rebase-abort Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH - -createrepo() { - rm -rf repo - hg init repo - cd repo - echo 'c1' >common - hg add common - hg commit -d '0 0' -m "C1" - - echo 'c2' >>common - hg commit -d '1 0' -m "C2" - - echo 'c3' >>common - hg commit -d '2 0' -m "C3" - - hg update -C 1 - echo 'l1' >>extra - hg add extra - hg commit -d '3 0' -m "L1" - - sed -e 's/c2/l2/' common > common.new - mv common.new common - hg commit -d '4 0' -m "L2" -} - -echo -createrepo > /dev/null 2>&1 -hg --config extensions.hgext.graphlog= glog --template '{rev}: {desc}\n' - -echo -echo '% Conflicting rebase' -hg --config extensions.hgext.rebase= rebase -s 3 -d 2 | cleanrebase - -echo -echo '% Abort' -hg --config extensions.hgext.rebase= rebase --abort | cleanrebase - -hg --config extensions.hgext.graphlog= glog --template '{rev}: {desc}\n' - -createrepo() { - rm -rf repo - hg init repo - cd repo - echo "a">a - hg ci -A -m'A' - echo "b">b - hg ci -A -m'B' - echo "c">c - hg ci -A -m'C' - hg up 0 - echo "b">b - hg ci -A -m'B bis' - echo "c1">c - hg ci -A -m'C1' -} -echo -echo '% Rebase and abort without generating new changesets' - -echo -createrepo > /dev/null 2>&1 -hg --config extensions.hgext.graphlog= glog --template '{rev}:{desc|short}\n' - -hg --config extensions.hgext.rebase= rebase -b 4 -d 2 | cleanrebase - -hg --config extensions.hgext.graphlog= glog --template '{rev}:{desc|short}\n' - -hg rebase -a | cleanrebase -hg glog --template '{rev}:{desc|short}\n' - diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-abort.out --- a/tests/test-rebase-abort.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ - -@ 4: L2 -| -o 3: L1 -| -| o 2: C3 -|/ -o 1: C2 -| -o 0: C1 - - -% Conflicting rebase -warning: conflicts during merge. -merging common failed! -abort: fix unresolved conflicts with hg resolve then run hg rebase --continue -merging common - -% Abort -saved backup bundle to -rebase aborted -@ 4: L2 -| -o 3: L1 -| -| o 2: C3 -|/ -o 1: C2 -| -o 0: C1 - - -% Rebase and abort without generating new changesets - -@ 4:C1 -| -o 3:B bis -| -| o 2:C -| | -| o 1:B -|/ -o 0:A - -warning: conflicts during merge. -merging c failed! -abort: fix unresolved conflicts with hg resolve then run hg rebase --continue -merging c -@ 4:C1 -| -o 3:B bis -| -| @ 2:C -| | -| o 1:B -|/ -o 0:A - -rebase aborted -@ 4:C1 -| -o 3:B bis -| -| o 2:C -| | -| o 1:B -|/ -o 0:A - diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-abort.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-abort.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,148 @@ + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF + + + $ hg init a + $ cd a + + $ echo c1 > common + $ hg add common + $ hg ci -m C1 + + $ echo c2 >> common + $ hg ci -m C2 + + $ echo c3 >> common + $ hg ci -m C3 + + $ hg up -q -C 1 + + $ echo l1 >> extra + $ hg add extra + $ hg ci -m L1 + created new head + + $ sed -e 's/c2/l2/' common > common.new + $ mv common.new common + $ hg ci -m L2 + + $ hg tglog + @ 4: 'L2' + | + o 3: 'L1' + | + | o 2: 'C3' + |/ + o 1: 'C2' + | + o 0: 'C1' + + +Conflicting rebase: + + $ hg rebase -s 3 -d 2 + merging common + warning: conflicts during merge. + merging common failed! + abort: fix unresolved conflicts with hg resolve then run hg rebase --continue + [255] + +Abort: + + $ hg rebase --abort + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + rebase aborted + + $ hg tglog + @ 4: 'L2' + | + o 3: 'L1' + | + | o 2: 'C3' + |/ + o 1: 'C2' + | + o 0: 'C1' + + $ cd .. + + +Constrcut new repo: + + $ hg init b + $ cd b + + $ echo a > a + $ hg ci -Am A + adding a + + $ echo b > b + $ hg ci -Am B + adding b + + $ echo c > c + $ hg ci -Am C + adding c + + $ hg up -q 0 + + $ echo b > b + $ hg ci -Am 'B bis' + adding b + created new head + + $ echo c1 > c + $ hg ci -Am C1 + adding c + +Rebase and abort without generating new changesets: + + $ hg tglog + @ 4: 'C1' + | + o 3: 'B bis' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg rebase -b 4 -d 2 + merging c + warning: conflicts during merge. + merging c failed! + abort: fix unresolved conflicts with hg resolve then run hg rebase --continue + [255] + + $ hg tglog + @ 4: 'C1' + | + o 3: 'B bis' + | + | @ 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg rebase -a + rebase aborted + + $ hg tglog + @ 4: 'C1' + | + o 3: 'B bis' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-cache --- a/tests/test-rebase-cache Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -createrepo() { - rm -rf repo - hg init repo - cd repo - - echo "a" > a - hg commit -d '0 0' -A -m 'A' - - hg branch branch1 - hg commit -d '1 0' -m 'Branch1' - - echo "b" > b - hg commit -A -d '2 0' -m 'B' - - hg up 0 - hg branch branch2 - hg commit -d '3 0' -m 'Branch2' - - echo "c" > C - hg commit -A -d '4 0' -m 'C' - - hg up 2 - hg branch -f branch2 - echo "d" > d - hg commit -A -d '5 0' -m 'D' - - echo "e" > e - hg commit -A -d '6 0' -m 'E' - - hg update default - - hg branch branch3 - hg commit -d '7 0' -m 'Branch3' - - echo "f" > f - hg commit -A -d '8 0' -m 'F' -} - -echo -createrepo > /dev/null 2>&1 -hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' - -echo -echo '% Branches' -hg branches - -echo -echo '% Heads' -hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n' - -echo -echo '% Rebase part of branch2 (5-6) onto branch3 (8)' -hg --config extensions.hgext.rebase= rebase --detach -s 5 -d 8 | hidebackup - -echo -echo '% Branches' -hg branches - -echo -echo '% Heads' -hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n' - -echo -hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' - -echo -echo '% Rebase head of branch3 (8) onto branch2 (6)' -createrepo > /dev/null 2>&1 -hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' - -hg --config extensions.hgext.rebase= rebase --detach -s 8 -d 6 | hidebackup - -echo -echo '% Branches' -hg branches - -echo -echo '% Heads' -hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n' - -echo -hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' -hg verify -q - -echo -echo '% Rebase entire branch3 (7-8) onto branch2 (6)' -createrepo > /dev/null 2>&1 -hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' - -hg --config extensions.hgext.rebase= rebase --detach -s 7 -d 6 | hidebackup - -echo -echo '% Branches' -hg branches - -echo -echo '% Heads' -hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n' - -echo -hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' -hg verify -q diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-cache.out --- a/tests/test-rebase-cache.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ - -@ 8:c11d5b3e9c00 F branch: branch3 -| -o 7:33c9da881988 Branch3 branch: branch3 -| -| o 6:0e4064ab11a3 E branch: branch2 -| | -| o 5:5ac035cb5d8f D branch: branch2 -| | -| | o 4:8e66061486ee C branch: branch2 -| | | -+---o 3:99567862abbe Branch2 branch: branch2 -| | -| o 2:65a26a4d12f6 B branch: branch1 -| | -| o 1:0f3f3010ee16 Branch1 branch: branch1 -|/ -o 0:1994f17a630e A branch: - - -% Branches -branch3 8:c11d5b3e9c00 -branch2 6:0e4064ab11a3 -branch1 2:65a26a4d12f6 (inactive) -default 0:1994f17a630e (inactive) - -% Heads -8:c11d5b3e9c00 F branch: branch3 -6:0e4064ab11a3 E branch: branch2 -4:8e66061486ee C branch: branch2 -2:65a26a4d12f6 B branch: branch1 -0:1994f17a630e A branch: - -% Rebase part of branch2 (5-6) onto branch3 (8) -saved backup bundle to - -% Branches -branch3 8:c9bfa9beb84e -branch2 4:8e66061486ee -branch1 2:65a26a4d12f6 -default 0:1994f17a630e (inactive) - -% Heads -8:c9bfa9beb84e E branch: branch3 -4:8e66061486ee C branch: branch2 -2:65a26a4d12f6 B branch: branch1 -0:1994f17a630e A branch: - -@ 8:c9bfa9beb84e E branch: branch3 -| -o 7:bf9037384081 D branch: branch3 -| -o 6:c11d5b3e9c00 F branch: branch3 -| -o 5:33c9da881988 Branch3 branch: branch3 -| -| o 4:8e66061486ee C branch: branch2 -| | -| o 3:99567862abbe Branch2 branch: branch2 -|/ -| o 2:65a26a4d12f6 B branch: branch1 -| | -| o 1:0f3f3010ee16 Branch1 branch: branch1 -|/ -o 0:1994f17a630e A branch: - - -% Rebase head of branch3 (8) onto branch2 (6) -@ 8:c11d5b3e9c00 F branch: branch3 -| -o 7:33c9da881988 Branch3 branch: branch3 -| -| o 6:0e4064ab11a3 E branch: branch2 -| | -| o 5:5ac035cb5d8f D branch: branch2 -| | -| | o 4:8e66061486ee C branch: branch2 -| | | -+---o 3:99567862abbe Branch2 branch: branch2 -| | -| o 2:65a26a4d12f6 B branch: branch1 -| | -| o 1:0f3f3010ee16 Branch1 branch: branch1 -|/ -o 0:1994f17a630e A branch: - -saved backup bundle to - -% Branches -branch2 8:b44d3024f247 -branch3 7:33c9da881988 -branch1 2:65a26a4d12f6 (inactive) -default 0:1994f17a630e (inactive) - -% Heads -8:b44d3024f247 F branch: branch2 -7:33c9da881988 Branch3 branch: branch3 -4:8e66061486ee C branch: branch2 -2:65a26a4d12f6 B branch: branch1 -0:1994f17a630e A branch: - -@ 8:b44d3024f247 F branch: branch2 -| -| o 7:33c9da881988 Branch3 branch: branch3 -| | -o | 6:0e4064ab11a3 E branch: branch2 -| | -o | 5:5ac035cb5d8f D branch: branch2 -| | -| | o 4:8e66061486ee C branch: branch2 -| | | -| | o 3:99567862abbe Branch2 branch: branch2 -| |/ -o | 2:65a26a4d12f6 B branch: branch1 -| | -o | 1:0f3f3010ee16 Branch1 branch: branch1 -|/ -o 0:1994f17a630e A branch: - - -% Rebase entire branch3 (7-8) onto branch2 (6) -@ 8:c11d5b3e9c00 F branch: branch3 -| -o 7:33c9da881988 Branch3 branch: branch3 -| -| o 6:0e4064ab11a3 E branch: branch2 -| | -| o 5:5ac035cb5d8f D branch: branch2 -| | -| | o 4:8e66061486ee C branch: branch2 -| | | -+---o 3:99567862abbe Branch2 branch: branch2 -| | -| o 2:65a26a4d12f6 B branch: branch1 -| | -| o 1:0f3f3010ee16 Branch1 branch: branch1 -|/ -o 0:1994f17a630e A branch: - -saved backup bundle to - -% Branches -branch2 7:b44d3024f247 -branch1 2:65a26a4d12f6 (inactive) -default 0:1994f17a630e (inactive) - -% Heads -7:b44d3024f247 F branch: branch2 -4:8e66061486ee C branch: branch2 -2:65a26a4d12f6 B branch: branch1 -0:1994f17a630e A branch: - -@ 7:b44d3024f247 F branch: branch2 -| -o 6:0e4064ab11a3 E branch: branch2 -| -o 5:5ac035cb5d8f D branch: branch2 -| -| o 4:8e66061486ee C branch: branch2 -| | -| o 3:99567862abbe Branch2 branch: branch2 -| | -o | 2:65a26a4d12f6 B branch: branch1 -| | -o | 1:0f3f3010ee16 Branch1 branch: branch1 -|/ -o 0:1994f17a630e A branch: - diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-cache.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-cache.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,257 @@ + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > theads = heads --template "{rev}: '{desc}' {branches}\n" + > EOF + + $ hg init a + $ cd a + + $ echo a > a + $ hg ci -Am A + adding a + + $ hg branch branch1 + marked working directory as branch branch1 + $ hg ci -m 'branch1' + + $ echo b > b + $ hg ci -Am B + adding b + + $ hg up -q 0 + + $ hg branch branch2 + marked working directory as branch branch2 + $ hg ci -m 'branch2' + + $ echo c > C + $ hg ci -Am C + adding C + + $ hg up -q 2 + + $ hg branch -f branch2 + marked working directory as branch branch2 + $ echo d > d + $ hg ci -Am D + adding d + created new head + + $ echo e > e + $ hg ci -Am E + adding e + + $ hg update default + 0 files updated, 0 files merged, 3 files removed, 0 files unresolved + + $ hg branch branch3 + marked working directory as branch branch3 + $ hg ci -m 'branch3' + + $ echo f > f + $ hg ci -Am F + adding f + + $ cd .. + + +Rebase part of branch2 (5-6) onto branch3 (8): + + $ hg clone -q -u . a a1 + $ cd a1 + + $ hg tglog + @ 8: 'F' branch3 + | + o 7: 'branch3' branch3 + | + | o 6: 'E' branch2 + | | + | o 5: 'D' branch2 + | | + | | o 4: 'C' branch2 + | | | + +---o 3: 'branch2' branch2 + | | + | o 2: 'B' branch1 + | | + | o 1: 'branch1' branch1 + |/ + o 0: 'A' + + $ hg branches + branch3 8:05b64c4ca2d8 + branch2 6:b410fbec727a + branch1 2:9d931918fcf7 (inactive) + default 0:1994f17a630e (inactive) + + $ hg theads + 8: 'F' branch3 + 6: 'E' branch2 + 4: 'C' branch2 + 2: 'B' branch1 + 0: 'A' + + $ hg rebase --detach -s 5 -d 8 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg branches + branch3 8:c1d4b9719987 + branch2 4:1be2b203ae5e + branch1 2:9d931918fcf7 + default 0:1994f17a630e (inactive) + + $ hg theads + 8: 'E' branch3 + 4: 'C' branch2 + 2: 'B' branch1 + 0: 'A' + + $ hg tglog + @ 8: 'E' branch3 + | + o 7: 'D' branch3 + | + o 6: 'F' branch3 + | + o 5: 'branch3' branch3 + | + | o 4: 'C' branch2 + | | + | o 3: 'branch2' branch2 + |/ + | o 2: 'B' branch1 + | | + | o 1: 'branch1' branch1 + |/ + o 0: 'A' + + $ cd .. + + +Rebase head of branch3 (8) onto branch2 (6): + + $ hg clone -q -u . a a2 + $ cd a2 + + $ hg tglog + @ 8: 'F' branch3 + | + o 7: 'branch3' branch3 + | + | o 6: 'E' branch2 + | | + | o 5: 'D' branch2 + | | + | | o 4: 'C' branch2 + | | | + +---o 3: 'branch2' branch2 + | | + | o 2: 'B' branch1 + | | + | o 1: 'branch1' branch1 + |/ + o 0: 'A' + + $ hg rebase --detach -s 8 -d 6 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg branches + branch2 8:e1e80ed73210 + branch3 7:75fd7b643dce + branch1 2:9d931918fcf7 (inactive) + default 0:1994f17a630e (inactive) + + $ hg theads + 8: 'F' branch2 + 7: 'branch3' branch3 + 4: 'C' branch2 + 2: 'B' branch1 + 0: 'A' + + $ hg tglog + @ 8: 'F' branch2 + | + | o 7: 'branch3' branch3 + | | + o | 6: 'E' branch2 + | | + o | 5: 'D' branch2 + | | + | | o 4: 'C' branch2 + | | | + | | o 3: 'branch2' branch2 + | |/ + o | 2: 'B' branch1 + | | + o | 1: 'branch1' branch1 + |/ + o 0: 'A' + + $ hg verify -q + + $ cd .. + + +Rebase entire branch3 (7-8) onto branch2 (6): + + $ hg clone -q -u . a a3 + $ cd a3 + + $ hg tglog + @ 8: 'F' branch3 + | + o 7: 'branch3' branch3 + | + | o 6: 'E' branch2 + | | + | o 5: 'D' branch2 + | | + | | o 4: 'C' branch2 + | | | + +---o 3: 'branch2' branch2 + | | + | o 2: 'B' branch1 + | | + | o 1: 'branch1' branch1 + |/ + o 0: 'A' + + $ hg rebase --detach -s 7 -d 6 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg branches + branch2 7:e1e80ed73210 + branch1 2:9d931918fcf7 (inactive) + default 0:1994f17a630e (inactive) + + $ hg theads + 7: 'F' branch2 + 4: 'C' branch2 + 2: 'B' branch1 + 0: 'A' + + $ hg tglog + @ 7: 'F' branch2 + | + o 6: 'E' branch2 + | + o 5: 'D' branch2 + | + | o 4: 'C' branch2 + | | + | o 3: 'branch2' branch2 + | | + o | 2: 'B' branch1 + | | + o | 1: 'branch1' branch1 + |/ + o 0: 'A' + + $ hg verify -q + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-check-restore --- a/tests/test-rebase-check-restore Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH - -BASE=`pwd` - -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} - -commit () { - hg commit -d "${2} 0" -m $1 -} - -createrepo () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 - echo "C" >> A - commit "C" 2 - - hg update -C 0 - echo "D" >> A - commit "D" 3 - addcommit "E" 4 - - hg update -C 0 - hg branch 'notdefault' - echo "F" >> A - commit "F" 5 -} - -echo -echo "% - Rebasing B onto E - check keep" -createrepo > /dev/null 2>&1 -hg glog --template '{rev}:{desc}:{branches}\n' -hg rebase -s 1 -d 4 --keep | hidebackup - -echo -echo "% - Solve the conflict and go on" -echo 'conflict solved' > A -rm A.orig -hg resolve -m A -hg rebase --continue | hidebackup -hg glog --template '{rev}:{desc}:{branches}\n' - -echo -echo "% - Rebase F onto E - check keepbranches" -createrepo > /dev/null 2>&1 -hg glog --template '{rev}:{desc}:{branches}\n' -hg rebase -s 5 -d 4 --keepbranches | hidebackup - -echo -echo "% - Solve the conflict and go on" -echo 'conflict solved' > A -rm A.orig -hg resolve -m A -hg rebase --continue 2>&1 | hidebackup -hg glog --template '{rev}:{desc}:{branches}\n' - -exit 0 diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-check-restore.out --- a/tests/test-rebase-check-restore.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ - -% - Rebasing B onto E - check keep -@ 5:F:notdefault -| -| o 4:E: -| | -| o 3:D: -|/ -| o 2:C: -| | -| o 1:B: -|/ -o 0:A: - -warning: conflicts during merge. -merging A failed! -abort: fix unresolved conflicts with hg resolve then run hg rebase --continue -merging A - -% - Solve the conflict and go on -@ 7:C: -| -o 6:B: -| -| o 5:F:notdefault -| | -o | 4:E: -| | -o | 3:D: -|/ -| o 2:C: -| | -| o 1:B: -|/ -o 0:A: - - -% - Rebase F onto E - check keepbranches -@ 5:F:notdefault -| -| o 4:E: -| | -| o 3:D: -|/ -| o 2:C: -| | -| o 1:B: -|/ -o 0:A: - -warning: conflicts during merge. -merging A failed! -abort: fix unresolved conflicts with hg resolve then run hg rebase --continue -merging A - -% - Solve the conflict and go on -saved backup bundle to -@ 5:F:notdefault -| -o 4:E: -| -o 3:D: -| -| o 2:C: -| | -| o 1:B: -|/ -o 0:A: - diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-check-restore.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-check-restore.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,142 @@ + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF + + + $ hg init a + $ cd a + + $ echo A > A + $ hg add A + $ hg ci -m A + + $ echo 'B' > B + $ hg add B + $ hg ci -m B + + $ echo C >> A + $ hg ci -m C + + $ hg up -q -C 0 + + $ echo D >> A + $ hg ci -m D + created new head + + $ echo E > E + $ hg add E + $ hg ci -m E + + $ hg up -q -C 0 + + $ hg branch 'notdefault' + marked working directory as branch notdefault + $ echo F >> A + $ hg ci -m F + + $ cd .. + + +Rebasing B onto E - check keep: + + $ hg clone -q -u . a a1 + $ cd a1 + + $ hg tglog + @ 5: 'F' notdefault + | + | o 4: 'E' + | | + | o 3: 'D' + |/ + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg rebase -s 1 -d 4 --keep + merging A + warning: conflicts during merge. + merging A failed! + abort: fix unresolved conflicts with hg resolve then run hg rebase --continue + [255] + +Solve the conflict and go on: + + $ echo 'conflict solved' > A + $ rm A.orig + $ hg resolve -m A + $ hg rebase --continue + + $ hg tglog + @ 7: 'C' + | + o 6: 'B' + | + | o 5: 'F' notdefault + | | + o | 4: 'E' + | | + o | 3: 'D' + |/ + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ cd .. + + +Rebase F onto E - check keepbranches: + + $ hg clone -q -u . a a2 + $ cd a2 + + $ hg tglog + @ 5: 'F' notdefault + | + | o 4: 'E' + | | + | o 3: 'D' + |/ + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg rebase -s 5 -d 4 --keepbranches + merging A + warning: conflicts during merge. + merging A failed! + abort: fix unresolved conflicts with hg resolve then run hg rebase --continue + [255] + +Solve the conflict and go on: + + $ echo 'conflict solved' > A + $ rm A.orig + $ hg resolve -m A + $ hg rebase --continue + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 5: 'F' notdefault + | + o 4: 'E' + | + o 3: 'D' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-collapse --- a/tests/test-rebase-collapse Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH - -BASE=`pwd` - -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} - -commit () { - hg commit -d "${2} 0" -m $1 -} - -createrepo () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 - addcommit "C" 2 - addcommit "D" 3 - - hg update -C 0 - addcommit "E" 4 - - hg update -C 0 - addcommit "F" 5 - - hg merge -r 4 - commit "G" 6 - - hg update -C 5 - addcommit "H" 7 -} - -createrepo > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' -echo '% Rebasing B onto H' -hg up -C 3 -hg rebase --collapse --keepbranches | hidebackup -hg glog --template '{rev}: {desc}\n' -echo "Expected A, B, C, D, F, H" -hg manifest - -createrepo > /dev/null 2>&1 -echo -echo '% Rebasing G onto H' -hg rebase --base 6 --collapse | hidebackup -hg glog --template '{rev}: {desc}\n' -echo "Expected A, E, F, H" -hg manifest - -createrepocomplex () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 - - hg up 0 - addcommit "C" 2 - hg merge - commit "D" 3 - - hg up 1 - addcommit "E" 4 - - addcommit "F" 5 - - hg merge - commit "G" 6 - - hg up 0 - addcommit "H" 7 -} - -echo -createrepocomplex > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' - -echo -echo '% Rebase and collapse - more than one external (fail)' -hg rebase -s 2 --collapse - -echo -echo '% Rebase and collapse - E onto H' -hg rebase -s 4 --collapse | hidebackup -hg glog --template '{rev}: {desc}\n' -echo "Expected A, B, C, E, F, H" -hg manifest - -createrepocomplex () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 - - hg up 0 - addcommit "C" 2 - hg merge - commit "D" 3 - - hg up 1 - addcommit "E" 4 - - echo "F" > E - commit "F" 5 - - addcommit "G" 6 - - hg merge - commit "H" 7 - - hg up 0 - addcommit "I" 8 -} - -echo -createrepocomplex > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' - -echo -echo '% Rebase and collapse - E onto I' -hg rebase -s 4 --collapse | hidebackup - -hg glog --template '{rev}: {desc}\n' - -echo "Expected A, B, C, E, G, I" -hg manifest - -echo 'Cat E:' -cat E - -createrepocomplex () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 - - addcommit "C" 2 - hg up 1 - - addcommit "D" 3 - - hg merge - commit "E" 4 - - hg up 0 - addcommit "F" 5 -} - -echo -createrepocomplex > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' - -echo -echo '% Rebase and collapse - B onto F' -hg rebase -s 1 --collapse | hidebackup - -hg glog --template '{rev}: {desc}\n' - -echo "Expected A, B, C, D, F" -hg manifest -exit 0 diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-collapse.out --- a/tests/test-rebase-collapse.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,185 +0,0 @@ -@ 7: H -| -| o 6: G -|/| -o | 5: F -| | -| o 4: E -|/ -| o 3: D -| | -| o 2: C -| | -| o 1: B -|/ -o 0: A - -% Rebasing B onto H -3 files updated, 0 files merged, 2 files removed, 0 files unresolved -saved backup bundle to -@ 5: Collapsed revision -| * B -| * C -| * D -o 4: H -| -| o 3: G -|/| -o | 2: F -| | -| o 1: E -|/ -o 0: A - -Expected A, B, C, D, F, H -A -B -C -D -F -H - -% Rebasing G onto H -saved backup bundle to -@ 6: Collapsed revision -| * E -| * G -o 5: H -| -o 4: F -| -| o 3: D -| | -| o 2: C -| | -| o 1: B -|/ -o 0: A - -Expected A, E, F, H -A -E -F -H - -@ 7: H -| -| o 6: G -| |\ -| | o 5: F -| | | -| | o 4: E -| | | -| o | 3: D -| |\| -| o | 2: C -|/ / -| o 1: B -|/ -o 0: A - - -% Rebase and collapse - more than one external (fail) -abort: unable to collapse, there is more than one external parent - -% Rebase and collapse - E onto H -saved backup bundle to -@ 5: Collapsed revision -|\ * E -| | * F -| | * G -| o 4: H -| | -o | 3: D -|\ \ -| o | 2: C -| |/ -o / 1: B -|/ -o 0: A - -Expected A, B, C, E, F, H -A -B -C -E -F -H - -@ 8: I -| -| o 7: H -| |\ -| | o 6: G -| | | -| | o 5: F -| | | -| | o 4: E -| | | -| o | 3: D -| |\| -| o | 2: C -|/ / -| o 1: B -|/ -o 0: A - - -% Rebase and collapse - E onto I -merging E -saved backup bundle to -@ 5: Collapsed revision -|\ * E -| | * F -| | * G -| | * H -| o 4: I -| | -o | 3: D -|\ \ -| o | 2: C -| |/ -o / 1: B -|/ -o 0: A - -Expected A, B, C, E, G, I -A -B -C -E -G -I -Cat E: -F - -@ 5: F -| -| o 4: E -| |\ -| | o 3: D -| | | -| o | 2: C -| |/ -| o 1: B -|/ -o 0: A - - -% Rebase and collapse - B onto F -saved backup bundle to -@ 2: Collapsed revision -| * B -| * C -| * D -| * E -o 1: F -| -o 0: A - -Expected A, B, C, D, F -A -B -C -D -F diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-collapse.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-collapse.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,441 @@ + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF + +Create repo a: + + $ hg init a + $ cd a + + $ echo A > A + $ hg ci -Am A + adding A + $ echo B > B + $ hg ci -Am B + adding B + $ echo C > C + $ hg ci -Am C + adding C + $ echo D > D + $ hg ci -Am D + adding D + + $ hg up -q -C 0 + + $ echo E > E + $ hg ci -Am E + adding E + created new head + + $ hg up -q -C 0 + + $ echo F > F + $ hg ci -Am F + adding F + created new head + + $ hg merge -r 4 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg ci -m G + + $ hg up -q -C 5 + + $ echo H > H + $ hg ci -Am H + adding H + created new head + + $ hg tglog + @ 7: 'H' + | + | o 6: 'G' + |/| + o | 5: 'F' + | | + | o 4: 'E' + |/ + | o 3: 'D' + | | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ cd .. + + +Rebasing B onto H: + + $ hg clone -q -u 3 a a1 + $ cd a1 + + $ hg rebase --collapse --keepbranches + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 5: 'Collapsed revision + | * B + | * C + | * D' + o 4: 'H' + | + | o 3: 'G' + |/| + o | 2: 'F' + | | + | o 1: 'E' + |/ + o 0: 'A' + + $ hg manifest + A + B + C + D + F + H + + $ cd .. + + +Rebasing G onto H: + + $ hg clone -q -u . a a2 + $ cd a2 + + $ hg rebase --base 6 --collapse + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 6: 'Collapsed revision + | * E + | * G' + o 5: 'H' + | + o 4: 'F' + | + | o 3: 'D' + | | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg manifest + A + E + F + H + + $ cd .. + + +Create repo b: + + $ hg init b + $ cd b + + $ echo A > A + $ hg ci -Am A + adding A + $ echo B > B + $ hg ci -Am B + adding B + + $ hg up -q 0 + + $ echo C > C + $ hg ci -Am C + adding C + created new head + + $ hg merge + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + + $ echo D > D + $ hg ci -Am D + adding D + + $ hg up -q 1 + + $ echo E > E + $ hg ci -Am E + adding E + created new head + + $ echo F > F + $ hg ci -Am F + adding F + + $ hg merge + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg ci -m G + + $ hg up -q 0 + + $ echo H > H + $ hg ci -Am H + adding H + created new head + + $ hg tglog + @ 7: 'H' + | + | o 6: 'G' + | |\ + | | o 5: 'F' + | | | + | | o 4: 'E' + | | | + | o | 3: 'D' + | |\| + | o | 2: 'C' + |/ / + | o 1: 'B' + |/ + o 0: 'A' + + $ cd .. + + +Rebase and collapse - more than one external (fail): + + $ hg clone -q -u . b b1 + $ cd b1 + + $ hg rebase -s 2 --collapse + abort: unable to collapse, there is more than one external parent + [255] + +Rebase and collapse - E onto H: + + $ hg rebase -s 4 --collapse + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 5: 'Collapsed revision + |\ * E + | | * F + | | * G' + | o 4: 'H' + | | + o | 3: 'D' + |\ \ + | o | 2: 'C' + | |/ + o / 1: 'B' + |/ + o 0: 'A' + + $ hg manifest + A + B + C + D + E + F + H + + $ cd .. + + +Create repo c: + + $ hg init c + $ cd c + + $ echo A > A + $ hg ci -Am A + adding A + $ echo B > B + $ hg ci -Am B + adding B + + $ hg up -q 0 + + $ echo C > C + $ hg ci -Am C + adding C + created new head + + $ hg merge + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + + $ echo D > D + $ hg ci -Am D + adding D + + $ hg up -q 1 + + $ echo E > E + $ hg ci -Am E + adding E + created new head + $ echo F > E + $ hg ci -m 'F' + + $ echo G > G + $ hg ci -Am G + adding G + + $ hg merge + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + + $ hg ci -m H + + $ hg up -q 0 + + $ echo I > I + $ hg ci -Am I + adding I + created new head + + $ hg tglog + @ 8: 'I' + | + | o 7: 'H' + | |\ + | | o 6: 'G' + | | | + | | o 5: 'F' + | | | + | | o 4: 'E' + | | | + | o | 3: 'D' + | |\| + | o | 2: 'C' + |/ / + | o 1: 'B' + |/ + o 0: 'A' + + $ cd .. + + +Rebase and collapse - E onto I: + + $ hg clone -q -u . c c1 + $ cd c1 + + $ hg rebase -s 4 --collapse + merging E + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 5: 'Collapsed revision + |\ * E + | | * F + | | * G + | | * H' + | o 4: 'I' + | | + o | 3: 'D' + |\ \ + | o | 2: 'C' + | |/ + o / 1: 'B' + |/ + o 0: 'A' + + $ hg manifest + A + B + C + D + E + G + I + + $ cat E + F + + $ cd .. + + +Create repo d: + + $ hg init d + $ cd d + + $ echo A > A + $ hg ci -Am A + adding A + $ echo B > B + $ hg ci -Am B + adding B + $ echo C > C + $ hg ci -Am C + adding C + + $ hg up -q 1 + + $ echo D > D + $ hg ci -Am D + adding D + created new head + $ hg merge + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + + $ hg ci -m E + + $ hg up -q 0 + + $ echo F > F + $ hg ci -Am F + adding F + created new head + + $ hg tglog + @ 5: 'F' + | + | o 4: 'E' + | |\ + | | o 3: 'D' + | | | + | o | 2: 'C' + | |/ + | o 1: 'B' + |/ + o 0: 'A' + + $ cd .. + + +Rebase and collapse - B onto F: + + $ hg clone -q -u . d d1 + $ cd d1 + + $ hg rebase -s 1 --collapse + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 2: 'Collapsed revision + | * B + | * C + | * D + | * E' + o 1: 'F' + | + o 0: 'A' + + $ hg manifest + A + B + C + D + F + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-conflicts --- a/tests/test-rebase-conflicts Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH - -hg init a -cd a -echo 'c1' >common -hg add common -hg commit -d '0 0' -m "C1" - -echo 'c2' >>common -hg commit -d '1 0' -m "C2" - -echo 'c3' >>common -hg commit -d '2 0' -m "C3" - -hg update -C 1 -echo 'l1' >>extra -hg add extra -hg commit -d '3 0' -m "L1" - -sed -e 's/c2/l2/' common > common.new -mv common.new common -hg commit -d '4 0' -m "L2" - -echo 'l3' >> extra2 -hg add extra2 -hg commit -d '5 0' -m "L3" - -hg glog --template '{rev}: {desc}\n' - -echo -echo '% Try to call --continue' -hg rebase --continue - -echo -echo '% Conflicting rebase' -hg rebase -s 3 -d 2 - -echo -echo '% Try to continue without solving the conflict' -hg rebase --continue - -echo -echo '% Conclude rebase' -echo 'resolved merge' >common -hg resolve -m common -hg rebase --continue | cleanrebase - -hg glog --template '{rev}: {desc}\n' - -echo -echo '% Check correctness' -echo ' - Rev. 0' -hg cat -r 0 common - -echo ' - Rev. 1' -hg cat -r 1 common - -echo ' - Rev. 2' -hg cat -r 2 common - -echo ' - Rev. 3' -hg cat -r 3 common - -echo ' - Rev. 4' -hg cat -r 4 common - -echo ' - Rev. 5' -hg cat -r 5 common diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-conflicts.out --- a/tests/test-rebase-conflicts.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -created new head -@ 5: L3 -| -o 4: L2 -| -o 3: L1 -| -| o 2: C3 -|/ -o 1: C2 -| -o 0: C1 - - -% Try to call --continue -abort: no rebase in progress - -% Conflicting rebase -merging common -warning: conflicts during merge. -merging common failed! -abort: fix unresolved conflicts with hg resolve then run hg rebase --continue - -% Try to continue without solving the conflict -abort: unresolved merge conflicts (see hg resolve) - -% Conclude rebase -saved backup bundle to -@ 5: L3 -| -o 4: L2 -| -o 3: L1 -| -o 2: C3 -| -o 1: C2 -| -o 0: C1 - - -% Check correctness - - Rev. 0 -c1 - - Rev. 1 -c1 -c2 - - Rev. 2 -c1 -c2 -c3 - - Rev. 3 -c1 -c2 -c3 - - Rev. 4 -resolved merge - - Rev. 5 -resolved merge diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-conflicts.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-conflicts.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,115 @@ + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF + + $ hg init a + $ cd a + $ echo c1 >common + $ hg add common + $ hg ci -m C1 + + $ echo c2 >>common + $ hg ci -m C2 + + $ echo c3 >>common + $ hg ci -m C3 + + $ hg up -q -C 1 + + $ echo l1 >>extra + $ hg add extra + $ hg ci -m L1 + created new head + + $ sed -e 's/c2/l2/' common > common.new + $ mv common.new common + $ hg ci -m L2 + + $ echo l3 >> extra2 + $ hg add extra2 + $ hg ci -m L3 + + $ hg tglog + @ 5: 'L3' + | + o 4: 'L2' + | + o 3: 'L1' + | + | o 2: 'C3' + |/ + o 1: 'C2' + | + o 0: 'C1' + +Try to call --continue: + + $ hg rebase --continue + abort: no rebase in progress + [255] + +Conflicting rebase: + + $ hg rebase -s 3 -d 2 + merging common + warning: conflicts during merge. + merging common failed! + abort: fix unresolved conflicts with hg resolve then run hg rebase --continue + [255] + +Try to continue without solving the conflict: + + $ hg rebase --continue + abort: unresolved merge conflicts (see hg resolve) + [255] + +Conclude rebase: + + $ echo 'resolved merge' >common + $ hg resolve -m common + $ hg rebase --continue + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 5: 'L3' + | + o 4: 'L2' + | + o 3: 'L1' + | + o 2: 'C3' + | + o 1: 'C2' + | + o 0: 'C1' + +Check correctness: + + $ hg cat -r 0 common + c1 + + $ hg cat -r 1 common + c1 + c2 + + $ hg cat -r 2 common + c1 + c2 + c3 + + $ hg cat -r 3 common + c1 + c2 + c3 + + $ hg cat -r 4 common + resolved merge + + $ hg cat -r 5 common + resolved merge + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-detach --- a/tests/test-rebase-detach Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH - -BASE=`pwd` - -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} - -commit () { - hg commit -d "${2} 0" -m $1 -} - -createrepo () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 - addcommit "C" 2 - addcommit "D" 3 - - hg update -C 0 - addcommit "E" 4 -} - -createrepo > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' -echo '% Rebasing D onto E detaching from C' -hg rebase --detach -s 3 -d 4 | hidebackup -hg glog --template '{rev}: {desc}\n' -echo "Expected A, D, E" -hg manifest - -echo -createrepo > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' -echo '% Rebasing C onto E detaching from B' -hg rebase --detach -s 2 -d 4 | hidebackup -hg glog --template '{rev}: {desc}\n' -echo "Expected A, C, D, E" -hg manifest - -echo -createrepo > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' -echo '% Rebasing B onto E using detach (same as not using it)' -hg rebase --detach -s 1 -d 4 | hidebackup -hg glog --template '{rev}: {desc}\n' -echo "Expected A, B, C, D, E" -hg manifest - -echo -createrepo > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' -echo '% Rebasing C onto E detaching from B and collapsing' -hg rebase --detach --collapse -s 2 -d 4 | hidebackup -hg glog --template '{rev}: {desc}\n' -echo "Expected A, C, D, E" -hg manifest - -exit 0 diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-detach.out --- a/tests/test-rebase-detach.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -@ 4: E -| -| o 3: D -| | -| o 2: C -| | -| o 1: B -|/ -o 0: A - -% Rebasing D onto E detaching from C -saved backup bundle to -@ 4: D -| -o 3: E -| -| o 2: C -| | -| o 1: B -|/ -o 0: A - -Expected A, D, E -A -D -E - -@ 4: E -| -| o 3: D -| | -| o 2: C -| | -| o 1: B -|/ -o 0: A - -% Rebasing C onto E detaching from B -saved backup bundle to -@ 4: D -| -o 3: C -| -o 2: E -| -| o 1: B -|/ -o 0: A - -Expected A, C, D, E -A -C -D -E - -@ 4: E -| -| o 3: D -| | -| o 2: C -| | -| o 1: B -|/ -o 0: A - -% Rebasing B onto E using detach (same as not using it) -saved backup bundle to -@ 4: D -| -o 3: C -| -o 2: B -| -o 1: E -| -o 0: A - -Expected A, B, C, D, E -A -B -C -D -E - -@ 4: E -| -| o 3: D -| | -| o 2: C -| | -| o 1: B -|/ -o 0: A - -% Rebasing C onto E detaching from B and collapsing -saved backup bundle to -@ 3: Collapsed revision -| * C -| * D -o 2: E -| -| o 1: B -|/ -o 0: A - -Expected A, C, D, E -A -C -D -E diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-detach.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-detach.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,193 @@ + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF + + + $ hg init a + $ cd a + + $ echo A > A + $ hg ci -Am A + adding A + + $ echo B > B + $ hg ci -Am B + adding B + + $ echo C > C + $ hg ci -Am C + adding C + + $ echo D > D + $ hg ci -Am D + adding D + + $ hg up -q -C 0 + + $ echo E > E + $ hg ci -Am E + adding E + created new head + + $ cd .. + + +Rebasing D onto E detaching from C: + + $ hg clone -q -u . a a1 + $ cd a1 + + $ hg tglog + @ 4: 'E' + | + | o 3: 'D' + | | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg rebase --detach -s 3 -d 4 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 4: 'D' + | + o 3: 'E' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg manifest + A + D + E + + $ cd .. + + +Rebasing C onto E detaching from B: + + $ hg clone -q -u . a a2 + $ cd a2 + + $ hg tglog + @ 4: 'E' + | + | o 3: 'D' + | | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg rebase --detach -s 2 -d 4 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 4: 'D' + | + o 3: 'C' + | + o 2: 'E' + | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg manifest + A + C + D + E + + $ cd .. + + +Rebasing B onto E using detach (same as not using it): + + $ hg clone -q -u . a a3 + $ cd a3 + + $ hg tglog + @ 4: 'E' + | + | o 3: 'D' + | | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg rebase --detach -s 1 -d 4 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 4: 'D' + | + o 3: 'C' + | + o 2: 'B' + | + o 1: 'E' + | + o 0: 'A' + + $ hg manifest + A + B + C + D + E + + $ cd .. + + +Rebasing C onto E detaching from B and collapsing: + + $ hg clone -q -u . a a4 + $ cd a4 + + $ hg tglog + @ 4: 'E' + | + | o 3: 'D' + | | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg rebase --detach --collapse -s 2 -d 4 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 3: 'Collapsed revision + | * C + | * D' + o 2: 'E' + | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg manifest + A + C + D + E + + $ cd .. + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-interruptions --- a/tests/test-rebase-interruptions Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH - -BASE=`pwd` - -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} - -commit () { - hg commit -d "${2} 0" -m $1 -} - -createrepo () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 - echo "C" >> A - commit "C" 2 - - hg update -C 0 - echo "D" >> A - commit "D" 3 - addcommit "E" 4 -} - -echo "% Changes during an interruption - continue" -createrepo > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' - -echo -echo "% - Rebasing B onto E" -hg rebase -s 1 -d 4 | hidebackup - -echo -echo "% - Force a commit on C during the interruption" -hg update -C 2 -addcommit "Extra" 5 -hg glog --template '{rev}: {desc}\n' - -echo -echo "% - Resume the rebasing" -hg rebase --continue - -echo -echo "% - Solve the conflict and go on" -echo 'conflict solved' > A -rm A.orig -hg resolve -m A -hg rebase --continue -hg glog --template '{rev}: {desc}\n' - -echo -echo -echo "% Changes during an interruption - abort" -createrepo > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' - -echo -echo "% Rebasing B onto E" -hg rebase -s 1 -d 4 | hidebackup - -echo -echo "% Force a commit on B' during the interruption" -hg update -C 5 -addcommit "Extra" 6 -hg glog --template '{rev}: {desc}\n' - -echo -echo "% Abort the rebasing" -hg rebase --abort -hg glog --template '{rev}: {desc}\n' - -exit 0 diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-interruptions.out --- a/tests/test-rebase-interruptions.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -% Changes during an interruption - continue -@ 4: E -| -o 3: D -| -| o 2: C -| | -| o 1: B -|/ -o 0: A - - -% - Rebasing B onto E -warning: conflicts during merge. -merging A failed! -abort: fix unresolved conflicts with hg resolve then run hg rebase --continue -merging A - -% - Force a commit on C during the interruption -1 files updated, 0 files merged, 1 files removed, 0 files unresolved -@ 6: Extra -| -| o 5: B -| | -| o 4: E -| | -| o 3: D -| | -o | 2: C -| | -o | 1: B -|/ -o 0: A - - -% - Resume the rebasing -merging A -warning: conflicts during merge. -merging A failed! -abort: fix unresolved conflicts with hg resolve then run hg rebase --continue - -% - Solve the conflict and go on -warning: new changesets detected on source branch, not stripping -@ 7: C -| -| o 6: Extra -| | -o | 5: B -| | -o | 4: E -| | -o | 3: D -| | -| o 2: C -| | -| o 1: B -|/ -o 0: A - - - -% Changes during an interruption - abort -@ 4: E -| -o 3: D -| -| o 2: C -| | -| o 1: B -|/ -o 0: A - - -% Rebasing B onto E -warning: conflicts during merge. -merging A failed! -abort: fix unresolved conflicts with hg resolve then run hg rebase --continue -merging A - -% Force a commit on B' during the interruption -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ 6: Extra -| -o 5: B -| -o 4: E -| -o 3: D -| -| o 2: C -| | -| o 1: B -|/ -o 0: A - - -% Abort the rebasing -warning: new changesets detected on target branch, can't abort -@ 6: Extra -| -o 5: B -| -o 4: E -| -o 3: D -| -| o 2: C -| | -| o 1: B -|/ -o 0: A - diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-interruptions.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-interruptions.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,194 @@ + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF + + + $ hg init a + $ cd a + + $ echo A > A + $ hg ci -Am A + adding A + + $ echo B > B + $ hg ci -Am B + adding B + + $ echo C >> A + $ hg ci -m C + + $ hg up -q -C 0 + + $ echo D >> A + $ hg ci -m D + created new head + + $ echo E > E + $ hg ci -Am E + adding E + + $ cd .. + + +Changes during an interruption - continue: + + $ hg clone -q -u . a a1 + $ cd a1 + + $ hg tglog + @ 4: 'E' + | + o 3: 'D' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + +Rebasing B onto E: + + $ hg rebase -s 1 -d 4 + merging A + warning: conflicts during merge. + merging A failed! + abort: fix unresolved conflicts with hg resolve then run hg rebase --continue + [255] + +Force a commit on C during the interruption: + + $ hg up -q -C 2 + + $ echo 'Extra' > Extra + $ hg add Extra + $ hg ci -m 'Extra' + + $ hg tglog + @ 6: 'Extra' + | + | o 5: 'B' + | | + | o 4: 'E' + | | + | o 3: 'D' + | | + o | 2: 'C' + | | + o | 1: 'B' + |/ + o 0: 'A' + +Resume the rebasing: + + $ hg rebase --continue + merging A + warning: conflicts during merge. + merging A failed! + abort: fix unresolved conflicts with hg resolve then run hg rebase --continue + [255] + +Solve the conflict and go on: + + $ echo 'conflict solved' > A + $ rm A.orig + $ hg resolve -m A + + $ hg rebase --continue + warning: new changesets detected on source branch, not stripping + + $ hg tglog + @ 7: 'C' + | + | o 6: 'Extra' + | | + o | 5: 'B' + | | + o | 4: 'E' + | | + o | 3: 'D' + | | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ cd .. + + +Changes during an interruption - abort: + + $ hg clone -q -u . a a2 + $ cd a2 + + $ hg tglog + @ 4: 'E' + | + o 3: 'D' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + +Rebasing B onto E: + + $ hg rebase -s 1 -d 4 + merging A + warning: conflicts during merge. + merging A failed! + abort: fix unresolved conflicts with hg resolve then run hg rebase --continue + [255] + +Force a commit on B' during the interruption: + + $ hg up -q -C 5 + + $ echo 'Extra' > Extra + $ hg add Extra + $ hg ci -m 'Extra' + + $ hg tglog + @ 6: 'Extra' + | + o 5: 'B' + | + o 4: 'E' + | + o 3: 'D' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + +Abort the rebasing: + + $ hg rebase --abort + warning: new changesets detected on target branch, can't abort + [255] + + $ hg tglog + @ 6: 'Extra' + | + o 5: 'B' + | + o 4: 'E' + | + o 3: 'D' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ cd .. + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-issue-noparam-single-rev --- a/tests/test-rebase-issue-noparam-single-rev Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH - -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} - -hg init a -cd a -addcommit "c1" 0 -addcommit "c2" 1 - -addcommit "l1" 2 - -hg update -C 1 -addcommit "r1" 3 -addcommit "r2" 4 -hg glog --template '{rev}:{desc}\n' - -echo -echo '% Rebase with no arguments - single revision in source branch' -hg update -C 2 -hg rebase | hidebackup -hg glog --template '{rev}:{desc}\n' - -cd .. -rm -rf a -hg init a -cd a -addcommit "c1" 0 -addcommit "c2" 1 - -addcommit "l1" 2 -addcommit "l2" 3 - -hg update -C 1 -addcommit "r1" 4 -hg glog --template '{rev}:{desc}\n' - -echo -echo '% Rebase with no arguments - single revision in target branch' -hg update -C 3 -hg rebase 2>&1 | hidebackup -hg glog --template '{rev}:{desc}\n' diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-issue-noparam-single-rev.out --- a/tests/test-rebase-issue-noparam-single-rev.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -created new head -@ 4:r2 -| -o 3:r1 -| -| o 2:l1 -|/ -o 1:c2 -| -o 0:c1 - - -% Rebase with no arguments - single revision in source branch -1 files updated, 0 files merged, 2 files removed, 0 files unresolved -saved backup bundle to -@ 4:l1 -| -o 3:r2 -| -o 2:r1 -| -o 1:c2 -| -o 0:c1 - -0 files updated, 0 files merged, 2 files removed, 0 files unresolved -created new head -@ 4:r1 -| -| o 3:l2 -| | -| o 2:l1 -|/ -o 1:c2 -| -o 0:c1 - - -% Rebase with no arguments - single revision in target branch -2 files updated, 0 files merged, 1 files removed, 0 files unresolved -saved backup bundle to -@ 4:l2 -| -o 3:l1 -| -o 2:r1 -| -o 1:c2 -| -o 0:c1 - diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-issue-noparam-single-rev.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-issue-noparam-single-rev.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,123 @@ + $ cat >> $HGRCPATH < [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 + + $ echo c2 > c2 + $ hg ci -Am c2 + adding c2 + + $ echo l1 > l1 + $ hg ci -Am l1 + adding l1 + + $ hg up -q -C 1 + + $ echo r1 > r1 + $ hg ci -Am r1 + adding r1 + created new head + + $ echo r2 > r2 + $ hg ci -Am r2 + adding r2 + + $ hg tglog + @ 4: 'r2' + | + o 3: 'r1' + | + | o 2: 'l1' + |/ + o 1: 'c2' + | + o 0: 'c1' + +Rebase with no arguments - single revision in source branch: + + $ hg up -q -C 2 + + $ hg rebase + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 4: 'l1' + | + o 3: 'r2' + | + o 2: 'r1' + | + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. + + + $ hg init b + $ cd b + + $ echo c1 > c1 + $ hg ci -Am c1 + adding c1 + + $ echo c2 > c2 + $ hg ci -Am c2 + adding c2 + + $ echo l1 > l1 + $ hg ci -Am l1 + adding l1 + + $ echo l2 > l2 + $ hg ci -Am l2 + adding l2 + + $ hg up -q -C 1 + + $ echo r1 > r1 + $ hg ci -Am r1 + adding r1 + created new head + + $ hg tglog + @ 4: 'r1' + | + | o 3: 'l2' + | | + | o 2: 'l1' + |/ + o 1: 'c2' + | + o 0: 'c1' + +Rebase with no arguments - single revision in target branch: + + $ hg up -q -C 3 + + $ hg rebase + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 4: 'l2' + | + o 3: 'l1' + | + o 2: 'r1' + | + o 1: 'c2' + | + o 0: 'c1' + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-keep-branch --- a/tests/test-rebase-keep-branch Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -#!/bin/sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH - -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} - -hg init a -cd a -addcommit "c1" 0 -addcommit "c2" 1 - -addcommit "l1" 2 -addcommit "l2" 3 - -hg update -C 1 -hg branch 'notdefault' -addcommit "r1" 4 -hg glog --template '{rev}:{desc}:{branches}\n' - -echo -echo '% Rebase a branch while preserving the branch name' -hg update -C 3 -hg rebase -b 4 -d 3 --keepbranches -q -hg glog --template '{rev}:{desc}:{branches}\n' -echo '% dirstate branch should be "notdefault"' -hg branch diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-keep-branch.out --- a/tests/test-rebase-keep-branch.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -0 files updated, 0 files merged, 2 files removed, 0 files unresolved -marked working directory as branch notdefault -@ 4:r1:notdefault -| -| o 3:l2: -| | -| o 2:l1: -|/ -o 1:c2: -| -o 0:c1: - - -% Rebase a branch while preserving the branch name -2 files updated, 0 files merged, 1 files removed, 0 files unresolved -@ 4:r1:notdefault -| -o 3:l2: -| -o 2:l1: -| -o 1:c2: -| -o 0:c1: - -% dirstate branch should be "notdefault" -notdefault diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-keep-branch.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-keep-branch.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,71 @@ + $ cat >> $HGRCPATH < [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 + + $ echo c2 > c2 + $ hg ci -Am c2 + adding c2 + + $ echo l1 > l1 + $ hg ci -Am l1 + adding l1 + + $ echo l2 > l2 + $ hg ci -Am l2 + adding l2 + + $ hg up -q -C 1 + + $ hg branch 'notdefault' + marked working directory as branch notdefault + + $ echo r1 > r1 + $ hg ci -Am r1 + adding r1 + + $ hg tglog + @ 4: 'r1' notdefault + | + | o 3: 'l2' + | | + | o 2: 'l1' + |/ + o 1: 'c2' + | + o 0: 'c1' + + +Rebase a branch while preserving the branch name: + + $ hg up -q -C 3 + + $ hg rebase -b 4 -d 3 --keepbranches + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 4: 'r1' notdefault + | + o 3: 'l2' + | + o 2: 'l1' + | + o 1: 'c2' + | + o 0: 'c1' + + $ hg branch + notdefault + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-mq --- a/tests/test-rebase-mq Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH -echo "mq=" >> $HGRCPATH - -echo "[mq]" >> $HGRCPATH -echo "plain=true" >> $HGRCPATH - -filterpatch() -{ - sed -e "s/^\(# Date\).*/\1/" \ - -e "s/^\(# Node ID\).*/\1/" \ - -e "s/^\(# Parent\).*/\1/" \ - -e "s/^\(diff -r \)\([a-f0-9]* \)\(-r \)\([a-f0-9]* \)/\1x \3y /" \ - -e "s/^\(diff -r \)\([a-f0-9]* \)/\1x /" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" -} - -hg init a -cd a -hg qinit -c # This must work even with a managed mq queue - -echo 'c1' > f -hg add f -hg commit -d '0 0' -m "C1" - -echo 'r1' > f -hg commit -d '2 0' -m "R1" - -hg up 0 -hg qnew f.patch -echo 'mq1' > f -hg qref -m 'P0' - -hg qnew f2.patch -echo 'mq2' > f -hg qref -m 'P1' -hg glog --template '{rev} {desc} tags: {tags}\n' - -echo -echo '% Rebase - try to rebase on an applied mq patch' -hg rebase -s 1 -d 3 - -echo -echo '% Rebase - same thing, but mq patch is default dest' -hg update -q 1 -hg rebase -hg update -q qtip - -echo -echo '% Rebase - generate a conflict' -hg rebase -s 2 -d 1 - -echo -echo '% Fix the 1st conflict' -echo 'mq1r1' > f -hg resolve -m f -hg rebase -c | hidebackup - -echo -echo '% Fix the 2nd conflict' -echo 'mq1r1mq2' > f -hg resolve -m f -hg rebase -c | hidebackup - -hg glog --template '{rev} {desc} tags: {tags}\n' - -echo -echo '% Update to qbase' -hg up qbase -echo '% f correctly reflects the merge result' -cat f -echo '% And the patch is correct' -cat .hg/patches/f.patch | filterpatch - -echo -echo '% Update to qtip' -hg up qtip -echo '% f correctly reflects the merge result' -cat f -echo '% And the patch is correct' -cat .hg/patches/f2.patch | filterpatch - -echo -echo '% Adding one git-style patch and one normal' -hg qpop -a -rm -fr .hg/patches -hg qinit -c - -hg up 0 -hg qnew --git f_git.patch -echo 'mq1' > p -hg add p -hg qref --git -m 'P0 (git)' - -hg qnew f.patch -echo 'mq2' > p -hg qref -m 'P1' -hg qcommit -m 'save patch state' -echo '% patch series step 1/2' -hg qseries -s -echo '% patch queue manifest step 1/2' -hg -R .hg/patches manifest - -echo '% Git patch' -cat .hg/patches/f_git.patch | filterpatch - -echo -echo '% Normal patch' -cat .hg/patches/f.patch | filterpatch - -echo -echo '% Rebase the applied mq patches' -hg rebase -s 2 -d 1 --quiet -hg qcommit -m 'save patch state' -echo '% patch series step 2/2' -hg qseries -s -echo '% patch queue manifest step 2/2' -hg -R .hg/patches manifest - -echo '% And the patches are correct' -echo '% Git patch' -cat .hg/patches/f_git.patch | filterpatch - -echo -echo '% Normal patch' -cat .hg/patches/f.patch | filterpatch - diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-mq-skip --- a/tests/test-rebase-mq-skip Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -#!/bin/sh -# This emulates the effects of an hg pull --rebase in which the remote repo -# already has one local mq patch - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH -echo "mq=" >> $HGRCPATH - -hg init a -cd a -hg qinit -c # This must work even with a managed mq queue - -echo 'c1' > c1 -hg add c1 -hg commit -d '0 0' -m "C1" - -echo 'r1' > r1 -hg add r1 -hg commit -d '1 0' -m "R1" - -hg up 0 -hg qnew p0.patch -echo 'p0' > p0 -hg add p0 -hg qref -m 'P0' - -hg qnew p1.patch -echo 'p1' > p1 -hg add p1 -hg qref -m 'P1' -hg export qtip > p1.patch - -echo -echo '% "Mainstream" import p1.patch' -hg up -C 1 -hg import p1.patch -rm p1.patch - -echo -echo '% Rebase' -hg up -C qtip -hg rebase | hidebackup -hg glog --template '{rev} {desc} tags: {tags}\n' - -echo -echo '% Now with --continue' -cd .. -hg init b -cd b -hg qinit -c # This must work even with a managed mq queue - -for i in r0 r1 r2 r3 r4 r5 r6; -do - echo $i > $i - hg ci -Am $i -done -hg qimport -r 1:tip -hg up 0 -for i in r1 r3 r7 r8; -do - echo $i > $i - hg ci -Am branch2-$i -done -echo somethingelse > r4 -hg ci -Am branch2-r4 -echo r6 > r6 -hg ci -Am branch2-r6 - -hg up qtip -HGMERGE=internal:fail hg rebase | hidebackup -HGMERGE=internal:local hg resolve --all -hg rebase --continue | hidebackup -hg glog --template '{rev} {desc} tags: {tags}\n' diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-mq-skip.out --- a/tests/test-rebase-mq-skip.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -0 files updated, 0 files merged, 1 files removed, 0 files unresolved - -% "Mainstream" import p1.patch -1 files updated, 0 files merged, 2 files removed, 0 files unresolved -applying p1.patch - -% Rebase -1 files updated, 0 files merged, 1 files removed, 0 files unresolved -saved backup bundle to -@ 3 P0 tags: p0.patch qbase qtip tip -| -o 2 P1 tags: qparent -| -o 1 R1 tags: -| -o 0 C1 tags: - - -% Now with --continue -adding r0 -adding r1 -adding r2 -adding r3 -adding r4 -adding r5 -adding r6 -0 files updated, 0 files merged, 6 files removed, 0 files unresolved -adding r1 -created new head -adding r3 -adding r7 -adding r8 -adding r4 -adding r6 -3 files updated, 0 files merged, 2 files removed, 0 files unresolved -abort: fix unresolved conflicts with hg resolve then run hg rebase --continue -saved backup bundle to -@ 9 r5 tags: 5.diff qtip tip -| -o 8 r4 tags: 4.diff -| -o 7 r2 tags: 2.diff qbase -| -o 6 branch2-r6 tags: qparent -| -o 5 branch2-r4 tags: -| -o 4 branch2-r8 tags: -| -o 3 branch2-r7 tags: -| -o 2 branch2-r3 tags: -| -o 1 branch2-r1 tags: -| -o 0 r0 tags: - diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-mq-skip.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-mq-skip.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,136 @@ +This emulates the effects of an hg pull --rebase in which the remote repo +already has one local mq patch + + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > mq= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n" + > EOF + + + $ hg init a + $ cd a + $ hg qinit -c + + $ echo c1 > c1 + $ hg add c1 + $ hg ci -m C1 + + $ echo r1 > r1 + $ hg add r1 + $ hg ci -m R1 + + $ hg up -q 0 + + $ hg qnew p0.patch + $ echo p0 > p0 + $ hg add p0 + $ hg qref -m P0 + + $ hg qnew p1.patch + $ echo p1 > p1 + $ hg add p1 + $ hg qref -m P1 + + $ hg export qtip > p1.patch + + $ hg up -q -C 1 + + $ hg import p1.patch + applying p1.patch + + $ rm p1.patch + + $ hg up -q -C qtip + + $ hg rebase + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 3: 'P0' tags: p0.patch qbase qtip tip + | + o 2: 'P1' tags: qparent + | + o 1: 'R1' tags: + | + o 0: 'C1' tags: + + $ cd .. + + + $ hg init b + $ cd b + $ hg qinit -c + + $ for i in r0 r1 r2 r3 r4 r5 r6; + > do + > echo $i > $i + > hg ci -Am $i + > done + adding r0 + adding r1 + adding r2 + adding r3 + adding r4 + adding r5 + adding r6 + + $ hg qimport -r 1:tip + + $ hg up -q 0 + + $ for i in r1 r3 r7 r8; + > do + > echo $i > $i + > hg ci -Am branch2-$i + > done + adding r1 + created new head + adding r3 + adding r7 + adding r8 + + $ echo somethingelse > r4 + $ hg ci -Am branch2-r4 + adding r4 + + $ echo r6 > r6 + $ hg ci -Am branch2-r6 + adding r6 + + $ hg up -q qtip + + $ HGMERGE=internal:fail hg rebase + abort: fix unresolved conflicts with hg resolve then run hg rebase --continue + [255] + + $ HGMERGE=internal:local hg resolve --all + + $ hg rebase --continue + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 9: 'r5' tags: 5.diff qtip tip + | + o 8: 'r4' tags: 4.diff + | + o 7: 'r2' tags: 2.diff qbase + | + o 6: 'branch2-r6' tags: qparent + | + o 5: 'branch2-r4' tags: + | + o 4: 'branch2-r8' tags: + | + o 3: 'branch2-r7' tags: + | + o 2: 'branch2-r3' tags: + | + o 1: 'branch2-r1' tags: + | + o 0: 'r0' tags: + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-mq.out --- a/tests/test-rebase-mq.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ 3 P1 tags: f2.patch qtip tip -| -o 2 P0 tags: f.patch qbase -| -| o 1 R1 tags: -|/ -o 0 C1 tags: qparent - - -% Rebase - try to rebase on an applied mq patch -abort: cannot rebase onto an applied mq patch - -% Rebase - same thing, but mq patch is default dest -abort: cannot rebase onto an applied mq patch - -% Rebase - generate a conflict -merging f -warning: conflicts during merge. -merging f failed! -abort: fix unresolved conflicts with hg resolve then run hg rebase --continue - -% Fix the 1st conflict -warning: conflicts during merge. -merging f failed! -abort: fix unresolved conflicts with hg resolve then run hg rebase --continue -merging f - -% Fix the 2nd conflict -saved backup bundle to -@ 3 P1 tags: f2.patch qtip tip -| -o 2 P0 tags: f.patch qbase -| -o 1 R1 tags: qparent -| -o 0 C1 tags: - - -% Update to qbase -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -% f correctly reflects the merge result -mq1r1 -% And the patch is correct -# HG changeset patch -# User test -# Date -# Node ID -# Parent -P0 - -diff -r x -r y f ---- a/f -+++ b/f -@@ -1,1 +1,1 @@ --r1 -+mq1r1 - -% Update to qtip -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -% f correctly reflects the merge result -mq1r1mq2 -% And the patch is correct -# HG changeset patch -# User test -# Date -# Node ID -# Parent -P1 - -diff -r x -r y f ---- a/f -+++ b/f -@@ -1,1 +1,1 @@ --mq1r1 -+mq1r1mq2 - -% Adding one git-style patch and one normal -popping f2.patch -popping f.patch -patch queue now empty -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -% patch series step 1/2 -f_git.patch: P0 (git) -f.patch: P1 -% patch queue manifest step 1/2 -.hgignore -f.patch -f_git.patch -series -% Git patch -P0 (git) - -diff --git a/p b/p -new file mode 100644 ---- /dev/null -+++ b/p -@@ -0,0 +1,1 @@ -+mq1 - -% Normal patch -P1 - -diff -r x p ---- a/p -+++ b/p -@@ -1,1 +1,1 @@ --mq1 -+mq2 - -% Rebase the applied mq patches -% patch series step 2/2 -f_git.patch: P0 (git) -f.patch: P1 -% patch queue manifest step 2/2 -.hgignore -f.patch -f_git.patch -series -% And the patches are correct -% Git patch -# HG changeset patch -# User test -# Date -# Node ID -# Parent -P0 (git) - -diff --git a/p b/p -new file mode 100644 ---- /dev/null -+++ b/p -@@ -0,0 +1,1 @@ -+mq1 - -% Normal patch -# HG changeset patch -# User test -# Date -# Node ID -# Parent -P1 - ---- a/p -+++ b/p -@@ -1,1 +1,1 @@ --mq1 -+mq2 diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-mq.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-mq.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,237 @@ + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > mq= + > + > [mq] + > plain=true + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n" + > EOF + + + $ hg init a + $ cd a + $ hg qinit -c + + $ echo c1 > f + $ hg add f + $ hg ci -m C1 + + $ echo r1 > f + $ hg ci -m R1 + + $ hg up -q 0 + + $ hg qnew f.patch + $ echo mq1 > f + $ hg qref -m P0 + + $ hg qnew f2.patch + $ echo mq2 > f + $ hg qref -m P1 + + $ hg tglog + @ 3: 'P1' tags: f2.patch qtip tip + | + o 2: 'P0' tags: f.patch qbase + | + | o 1: 'R1' tags: + |/ + o 0: 'C1' tags: qparent + + +Rebase - try to rebase on an applied mq patch: + + $ hg rebase -s 1 -d 3 + abort: cannot rebase onto an applied mq patch + [255] + +Rebase - same thing, but mq patch is default dest: + + $ hg up -q 1 + $ hg rebase + abort: cannot rebase onto an applied mq patch + [255] + $ hg up -q qtip + +Rebase - generate a conflict: + + $ hg rebase -s 2 -d 1 + merging f + warning: conflicts during merge. + merging f failed! + abort: fix unresolved conflicts with hg resolve then run hg rebase --continue + [255] + +Fix the 1st conflict: + + $ echo mq1r1 > f + $ hg resolve -m f + $ hg rebase -c + merging f + warning: conflicts during merge. + merging f failed! + abort: fix unresolved conflicts with hg resolve then run hg rebase --continue + [255] + +Fix the 2nd conflict: + + $ echo mq1r1mq2 > f + $ hg resolve -m f + $ hg rebase -c + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 3: 'P1' tags: f2.patch qtip tip + | + o 2: 'P0' tags: f.patch qbase + | + o 1: 'R1' tags: qparent + | + o 0: 'C1' tags: + + $ hg up -q qbase + + $ cat f + mq1r1 + + $ cat .hg/patches/f.patch + # HG changeset patch + # User test + # Date ?????????? ? (glob) + # Node ID ???????????????????????????????????????? (glob) + # Parent bac9ed9960d8992bcad75864a879fa76cadaf1b0 + P0 + + diff -r bac9ed9960d8 -r ???????????? f (glob) + --- a/f Thu Jan 01 00:00:00 1970 +0000 + +++ b/f ??? ??? ?? ??:??:?? ???? ????? (glob) + @@ -1,1 +1,1 @@ + -r1 + +mq1r1 + +Update to qtip: + + $ hg up -q qtip + + $ cat f + mq1r1mq2 + + $ cat .hg/patches/f2.patch + # HG changeset patch + # User test + # Date ?????????? ? (glob) + # Node ID ???????????????????????????????????????? (glob) + # Parent ???????????????????????????????????????? (glob) + P1 + + diff -r ???????????? -r ???????????? f (glob) + --- a/f ??? ??? ?? ??:??:?? ???? ????? (glob) + +++ b/f ??? ??? ?? ??:??:?? ???? ????? (glob) + @@ -1,1 +1,1 @@ + -mq1r1 + +mq1r1mq2 + +Adding one git-style patch and one normal: + + $ hg qpop -a + popping f2.patch + popping f.patch + patch queue now empty + + $ rm -fr .hg/patches + $ hg qinit -c + + $ hg up -q 0 + + $ hg qnew --git f_git.patch + $ echo mq1 > p + $ hg add p + $ hg qref --git -m 'P0 (git)' + + $ hg qnew f.patch + $ echo mq2 > p + $ hg qref -m P1 + $ hg qci -m 'save patch state' + + $ hg qseries -s + f_git.patch: P0 (git) + f.patch: P1 + + $ hg -R .hg/patches manifest + .hgignore + f.patch + f_git.patch + series + + $ cat .hg/patches/f_git.patch + P0 (git) + + diff --git a/p b/p + new file mode 100644 + --- /dev/null + +++ b/p + @@ -0,0 +1,1 @@ + +mq1 + + $ cat .hg/patches/f.patch + P1 + + diff -r ???????????? p (glob) + --- a/p ??? ??? ?? ??:??:?? ???? ????? (glob) + +++ b/p ??? ??? ?? ??:??:?? ???? ????? (glob) + @@ -1,1 +1,1 @@ + -mq1 + +mq2 + + +Rebase the applied mq patches: + + $ hg rebase -s 2 -d 1 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg qci -m 'save patch state' + + $ hg qseries -s + f_git.patch: P0 (git) + f.patch: P1 + + $ hg -R .hg/patches manifest + .hgignore + f.patch + f_git.patch + series + + $ cat .hg/patches/f_git.patch + # HG changeset patch + # User test + # Date ?????????? ? (glob) + # Node ID ???????????????????????????????????????? (glob) + # Parent bac9ed9960d8992bcad75864a879fa76cadaf1b0 + P0 (git) + + diff --git a/p b/p + new file mode 100644 + --- /dev/null + +++ b/p + @@ -0,0 +1,1 @@ + +mq1 + + $ cat .hg/patches/f.patch + # HG changeset patch + # User test + # Date ?????????? ? (glob) + # Node ID ???????????????????????????????????????? (glob) + # Parent ???????????????????????????????????????? (glob) + P1 + + diff -r ???????????? -r ???????????? p (glob) + --- a/p ??? ??? ?? ??:??:?? ???? ????? (glob) + +++ b/p ??? ??? ?? ??:??:?? ???? ????? (glob) + @@ -1,1 +1,1 @@ + -mq1 + +mq2 + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-newancestor --- a/tests/test-rebase-newancestor Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH - -rm -rf repo -hg init repo -cd repo - -echo A > a -echo >> a -hg commit -AmA -u test -d '0 0' - -echo B > a -echo >> a -hg commit -mB -u test -d '1 0' - -echo C > a -echo >> a -hg commit -mC -u test -d '2 0' - -hg up -C 0 -echo D >> a -hg commit -AmAD -u test -d '3 0' - -hg glog --template '{rev}:{desc} {node|short}\n' -hg rebase -q -s 1 -d 3 | hidebackup -hg glog --template '{rev}:{desc} {node|short}\n' - -exit 0 diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-newancestor.out --- a/tests/test-rebase-newancestor.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -adding a -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -created new head -@ 3:AD 1d4e82ed3c2a -| -| o 2:C 7e1afe9214b2 -| | -| o 1:B 0a6620c3c26a -|/ -o 0:A 1e635d440a73 - -@ 3:C 0c5887756284 -| -o 2:B 4f208f4a1507 -| -o 1:AD 1d4e82ed3c2a -| -o 0:A 1e635d440a73 - diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-newancestor.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-newancestor.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,54 @@ + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF + + $ hg init repo + $ cd repo + + $ echo A > a + $ echo >> a + $ hg ci -Am A + adding a + + $ echo B > a + $ echo >> a + $ hg ci -m B + + $ echo C > a + $ echo >> a + $ hg ci -m C + + $ hg up -q -C 0 + + $ echo D >> a + $ hg ci -Am AD + created new head + + $ hg tglog + @ 3: 'AD' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg rebase -s 1 -d 3 + merging a + merging a + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 3: 'C' + | + o 2: 'B' + | + o 1: 'AD' + | + o 0: 'A' + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-parameters --- a/tests/test-rebase-parameters Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH - -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} - -commit () { - hg commit -d "${2} 0" -m $1 -} - -createrepo () { - hg init a - cd a - addcommit "c1" 0 - addcommit "c2" 1 - addcommit "c3" 2 - - hg update -C 1 - addcommit "l1" 3 - addcommit "l2" 4 - addcommit "l3" 5 - - hg update -C 2 - addcommit "r1" 6 - addcommit "r2" 7 -} - -createrepo > /dev/null 2>&1 -echo "% These fail" -echo -echo "% Use continue and abort" -hg rebase --continue --abort - -echo -echo "% Use continue and collapse" -hg rebase --continue --collapse - -echo -echo "% Use continue/abort and dest/source" -hg rebase --continue --dest 4 - -echo -echo "% Use source and base" -hg rebase --base 5 --source 4 - -echo -echo "% Rebase with no arguments - from current" -hg rebase - -echo -echo "% Rebase with no arguments - from the current branch" -hg update 6 -hg rebase - -echo "% ----------" -echo "% These work" -echo -echo "% Rebase with no arguments (from 3 onto 7)" -hg update -C 5 -hg rebase 2>&1 | hidebackup - -echo "% Try to rollback after a rebase (fail)" -hg rollback - -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 - -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 - -createrepo > /dev/null 2>&1 -echo -echo "% Specify only source (from 4 onto 7)" -hg rebase --source 4 | hidebackup - -createrepo > /dev/null 2>&1 -echo -echo "% Specify only dest (from 3 onto 6)" -hg update -C 5 -hg rebase --dest 6 | hidebackup - -createrepo > /dev/null 2>&1 -echo -echo "% Specify only base (from 3 onto 7)" -hg rebase --base 5 | hidebackup - -createrepo > /dev/null 2>&1 -echo -echo "% Specify source and dest (from 4 onto 6)" -hg rebase --source 4 --dest 6 | hidebackup - -createrepo > /dev/null 2>&1 -echo -echo "% Specify base and dest (from 3 onto 6)" -hg rebase --base 4 --dest 6 | hidebackup - -exit 0 diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-parameters.out --- a/tests/test-rebase-parameters.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -% These fail - -% Use continue and abort -abort: cannot use both abort and continue - -% Use continue and collapse -abort: cannot use collapse with continue or abort - -% Use continue/abort and dest/source -abort: abort and continue do not allow specifying revisions - -% Use source and base -abort: cannot specify both a revision and a base - -% Rebase with no arguments - from current -nothing to rebase - -% Rebase with no arguments - from the current branch -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -nothing to rebase -% ---------- -% These work - -% Rebase with no arguments (from 3 onto 7) -3 files updated, 0 files merged, 2 files removed, 0 files unresolved -saved backup bundle to -% Try to rollback after a rebase (fail) -no rollback information available - -% Rebase with base == '.' => same as no arguments (from 3 onto 7) -3 files updated, 0 files merged, 3 files removed, 0 files unresolved -saved backup bundle to - -% Rebase with dest == default => same as no arguments (from 3 onto 7) -3 files updated, 0 files merged, 3 files removed, 0 files unresolved -saved backup bundle to - -% Specify only source (from 4 onto 7) -saved backup bundle to - -% Specify only dest (from 3 onto 6) -3 files updated, 0 files merged, 3 files removed, 0 files unresolved -saved backup bundle to - -% Specify only base (from 3 onto 7) -saved backup bundle to - -% Specify source and dest (from 4 onto 6) -saved backup bundle to - -% Specify base and dest (from 3 onto 6) -saved backup bundle to diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-parameters.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-parameters.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,332 @@ + $ cat >> $HGRCPATH < [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 + + $ echo c2 > c2 + $ hg ci -Am c2 + adding c2 + + $ echo c3 > c3 + $ hg ci -Am c3 + adding c3 + + $ 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 + + $ 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 + + $ 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 .. + + +These fail: + + $ hg clone -q -u . a a1 + $ cd a1 + + $ hg rebase --continue --abort + abort: cannot use both abort and continue + [255] + + $ 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 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) + + $ 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 .. + + +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) + + $ 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 .. + + +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) + + $ 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) + + $ 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): + + $ hg clone -q -u 5 a a5 + $ cd a5 + + $ hg rebase --dest 6 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ 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 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) + + $ 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 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) + + $ 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): + + $ hg clone -q -u . a a8 + $ cd a8 + + $ hg rebase --base 4 --dest 6 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ 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 .. + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-pull --- a/tests/test-rebase-pull Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH - -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} - -commit () { - hg commit -d "${2} 0" -m $1 -} - -rm -rf a -hg init a -cd a -addcommit "C1" 0 -addcommit "C2" 1 - -cd .. -hg clone a b -# This is needed to test pull --rebase -hg clone a c - -cd b -addcommit "L1" 2 - -cd ../a -addcommit "R1" 3 - -cd ../b -echo -echo "% Now b has one revision to be pulled from a" -hg pull --rebase | hidebackup | sed -e 's/\(pulling from \).*/\1/' - -hg glog --template '{rev}:{desc}\n' - -echo -echo "% Re-run pull --rebase" -hg pull --rebase | sed 's/\(pulling from \).*/\1/' - -echo -echo "% Invoke pull --rebase and nothing to rebase" -cd ../c -hg pull --rebase 2>&1 | sed 's/\(pulling from \).*/\1/' -hg glog --template '{rev}\n' -l 1 - -echo -echo "% pull --rebase --update should ignore --update" -hg pull --rebase --update 2>&1 | sed 's/\(pulling from \).*/\1/' - -echo -echo "% pull --rebase doesn't update if nothing has been pulled" -hg up 1 -hg pull --rebase 2>&1 | sed 's/\(pulling from \).*/\1/' -hg glog --template '{rev}\n' -l 1 - -exit 0 diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-pull.out --- a/tests/test-rebase-pull.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% Now b has one revision to be pulled from a -pulling from -searching for changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files (+1 heads) -saved backup bundle to -@ 3:L1 -| -o 2:R1 -| -o 1:C2 -| -o 0:C1 - - -% Re-run pull --rebase -pulling from -searching for changes -no changes found - -% Invoke pull --rebase and nothing to rebase -pulling from -searching for changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -nothing to rebase -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ 2 -| - -% pull --rebase --update should ignore --update -pulling from -searching for changes -no changes found - -% pull --rebase doesn't update if nothing has been pulled -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -pulling from -searching for changes -no changes found -o 2 -| diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-pull.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-pull.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,113 @@ + $ cat >> $HGRCPATH < [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 + + $ echo C2 > C2 + $ hg ci -Am C2 + adding C2 + + $ cd .. + + $ hg clone a b + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ hg clone a c + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ cd b + + $ echo L1 > L1 + $ hg ci -Am L1 + adding L1 + + + $ cd ../a + + $ echo R1 > R1 + $ hg ci -Am R1 + adding R1 + + + $ cd ../b + +Now b has one revision to be pulled from a: + + $ hg pull --rebase + pulling from */a (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files (+1 heads) + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 3: 'L1' + | + o 2: 'R1' + | + o 1: 'C2' + | + o 0: 'C1' + +Re-run: + + $ hg pull --rebase + pulling from */a (glob) + searching for changes + no changes found + + +Invoke pull --rebase and nothing to rebase: + + $ cd ../c + + $ hg pull --rebase + pulling from */a (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + nothing to rebase + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ hg tglog -l 1 + @ 2: 'R1' + | + +pull --rebase --update should ignore --update: + + $ hg pull --rebase --update + pulling from */a (glob) + searching for changes + no changes found + +pull --rebase doesn't update if nothing has been pulled: + + $ hg up -q 1 + + $ hg pull --rebase + pulling from */a (glob) + searching for changes + no changes found + + $ hg tglog -l 1 + o 2: 'R1' + | + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-rename --- a/tests/test-rebase-rename Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH -echo "[diff]" >> $HGRCPATH -echo "git=1" >> $HGRCPATH - -BASE=`pwd` - -hg init repo1 -cd repo1 -echo "a">a -hg commit -Am "A" --date '0 0' -echo "b"> b -hg commit -Am "B" --date '1 0' -hg up -C 0 -hg mv a a-renamed -hg commit -m 'rename A' --date '2 0' - -echo -echo '% Rename is tracked' -hg log -p -r tip --template '{rev}:{desc}\n' - -echo '% Rebase the revision containing the rename' -hg rebase -s 2 -d 1 --quiet | cleanrebase - -echo -echo '% Rename is not lost' -hg log -p -r tip --template '{rev}:{desc}\n' - -cd $BASE -rm -rf repo1 -hg init repo1 -cd repo1 -echo "a">a -hg commit -Am "A" --date '0 0' -echo "b"> b -hg commit -Am "B" --date '1 0' -hg up -C 0 -hg cp a a-copied -hg commit -m 'copy A' --date '2 0' - -echo -echo '% Copy is tracked' -hg log -p -r tip --template '{rev}:{desc}\n' - -echo '% Rebase the revision containing the copy' -hg rebase -s 2 -d 1 --quiet | cleanrebase - -echo -echo '% Copy is not lost' -hg log -p -r tip --template '{rev}:{desc}\n' - diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-rename.out --- a/tests/test-rebase-rename.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -adding a -adding b -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -created new head - -% Rename is tracked -2:rename A -diff --git a/a b/a-renamed -rename from a -rename to a-renamed - -% Rebase the revision containing the rename - -% Rename is not lost -2:rename A -diff --git a/a b/a-renamed -rename from a -rename to a-renamed - -adding a -adding b -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -created new head - -% Copy is tracked -2:copy A -diff --git a/a b/a-copied -copy from a -copy to a-copied - -% Rebase the revision containing the copy - -% Copy is not lost -2:copy A -diff --git a/a b/a-copied -copy from a -copy to a-copied - diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-rename.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-rename.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,121 @@ + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tlog = log --template "{rev}: '{desc}' {branches}\n" + > tglog = tlog --graph + > EOF + + + $ hg init a + $ cd a + + $ echo a > a + $ hg ci -Am A + adding a + + $ echo b > b + $ hg ci -Am B + adding b + + $ hg up -q -C 0 + + $ hg mv a a-renamed + + $ hg ci -m 'rename A' + created new head + + $ hg tglog + @ 2: 'rename A' + | + | o 1: 'B' + |/ + o 0: 'A' + + +Rename is tracked: + + $ hg tlog -p --git -r tip + 2: 'rename A' + diff --git a/a b/a-renamed + rename from a + rename to a-renamed + +Rebase the revision containing the rename: + + $ hg rebase -s 2 -d 1 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 2: 'rename A' + | + o 1: 'B' + | + o 0: 'A' + + +Rename is not lost: + + $ hg tlog -p --git -r tip + 2: 'rename A' + diff --git a/a b/a-renamed + rename from a + rename to a-renamed + + $ cd .. + + + $ hg init b + $ cd b + + $ echo a > a + $ hg ci -Am A + adding a + + $ echo b > b + $ hg ci -Am B + adding b + + $ hg up -q -C 0 + + $ hg cp a a-copied + $ hg ci -m 'copy A' + created new head + + $ hg tglog + @ 2: 'copy A' + | + | o 1: 'B' + |/ + o 0: 'A' + +Copy is tracked: + + $ hg tlog -p --git -r tip + 2: 'copy A' + diff --git a/a b/a-copied + copy from a + copy to a-copied + +Rebase the revision containing the copy: + + $ hg rebase -s 2 -d 1 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 2: 'copy A' + | + o 1: 'B' + | + o 0: 'A' + +Copy is not lost: + + $ hg tlog -p --git -r tip + 2: 'copy A' + diff --git a/a b/a-copied + copy from a + copy to a-copied + diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-scenario-global --- a/tests/test-rebase-scenario-global Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH - -BASE=`pwd` - -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} - -commit () { - hg commit -d "${2} 0" -m $1 -} - -createrepo () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 - - hg update -C 0 - addcommit "C" 2 - - hg update -C 0 - addcommit "D" 3 - - hg merge -r 2 - commit "E" 4 - - hg update -C 3 - addcommit "F" 5 -} - -createrepo > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' - -echo '% Rebasing' -echo '% B onto F - simple rebase' -hg rebase -s 1 -d 5 | hidebackup -hg glog --template '{rev}: {desc}\n' - -createrepo > /dev/null 2>&1 -echo '% B onto D - intermediate point' -hg rebase -s 1 -d 3 | hidebackup -hg glog --template '{rev}: {desc}\n' - -createrepo > /dev/null 2>&1 -echo '% C onto F - skip of E' -hg rebase -s 2 -d 5 | hidebackup -hg glog --template '{rev}: {desc}\n' - -createrepo > /dev/null 2>&1 -echo '% D onto C - rebase of a branching point (skip E)' -hg rebase -s 3 -d 2 | hidebackup -hg glog --template '{rev}: {desc}\n' - -createrepo > /dev/null 2>&1 -echo '% E onto F - merged revision having a parent in ancestors of target' -hg rebase -s 4 -d 5 | hidebackup -hg glog --template '{rev}: {desc}\n' - -createrepo > /dev/null 2>&1 -echo '% D onto B - E maintains C as parent' -hg rebase -s 3 -d 1 | hidebackup -hg glog --template '{rev}: {desc}\n' - -echo '% These will fail (using --source)' -createrepo > /dev/null 2>&1 -echo '% E onto D - rebase onto an ancestor' -hg rebase -s 4 -d 3 -echo '% D onto E - rebase onto a descendant' -hg rebase -s 3 -d 4 -echo '% E onto B - merge revision with both parents not in ancestors of target' -hg rebase -s 4 -d 1 - -echo -echo '% These will abort gracefully (using --base)' -echo '% E onto E - rebase onto same changeset' -hg rebase -b 4 -d 4 -echo '% E onto D - rebase onto an ancestor' -hg rebase -b 4 -d 3 -echo '% D onto E - rebase onto a descendant' -hg rebase -b 3 -d 4 - -exit 0 diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-scenario-global.out --- a/tests/test-rebase-scenario-global.out Fri Oct 01 16:43:03 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -@ 5: F -| -| o 4: E -|/| -o | 3: D -| | -| o 2: C -|/ -| o 1: B -|/ -o 0: A - -% Rebasing -% B onto F - simple rebase -saved backup bundle to -@ 5: B -| -o 4: F -| -| o 3: E -|/| -o | 2: D -| | -| o 1: C -|/ -o 0: A - -% B onto D - intermediate point -saved backup bundle to -@ 5: B -| -| o 4: F -|/ -| o 3: E -|/| -o | 2: D -| | -| o 1: C -|/ -o 0: A - -% C onto F - skip of E -saved backup bundle to -@ 4: C -| -o 3: F -| -o 2: D -| -| o 1: B -|/ -o 0: A - -% D onto C - rebase of a branching point (skip E) -saved backup bundle to -@ 4: F -| -o 3: D -| -o 2: C -| -| o 1: B -|/ -o 0: A - -% E onto F - merged revision having a parent in ancestors of target -saved backup bundle to -@ 5: E -|\ -| o 4: F -| | -| o 3: D -| | -o | 2: C -|/ -| o 1: B -|/ -o 0: A - -% D onto B - E maintains C as parent -saved backup bundle to -@ 5: F -| -| o 4: E -|/| -o | 3: D -| | -| o 2: C -| | -o | 1: B -|/ -o 0: A - -% These will fail (using --source) -% E onto D - rebase onto an ancestor -abort: source is descendant of destination -% D onto E - rebase onto a descendant -abort: source is ancestor of destination -% E onto B - merge revision with both parents not in ancestors of target -abort: cannot use revision 4 as base, result would have 3 parents - -% These will abort gracefully (using --base) -% E onto E - rebase onto same changeset -nothing to rebase -% E onto D - rebase onto an ancestor -nothing to rebase -% D onto E - rebase onto a descendant -nothing to rebase diff -r 1393a81b3bdc -r 16b854cb80f1 tests/test-rebase-scenario-global.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-scenario-global.t Fri Oct 01 16:10:06 2010 +0200 @@ -0,0 +1,249 @@ + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF + + + $ hg init a + $ cd a + + $ echo A > A + $ hg ci -Am A + adding A + + $ echo B > B + $ hg ci -Am B + adding B + + $ hg up -q -C 0 + + $ echo C > C + $ hg ci -Am C + adding C + created new head + + $ hg up -q -C 0 + + $ echo D > D + $ hg ci -Am D + adding D + created new head + + $ hg merge -r 2 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + + $ hg ci -m E + + $ hg up -q -C 3 + + $ echo F > F + $ hg ci -Am F + adding F + created new head + + $ cd .. + + +Rebasing +B onto F - simple rebase: + + $ hg clone -q -u . a a1 + $ cd a1 + + $ hg tglog + @ 5: 'F' + | + | o 4: 'E' + |/| + o | 3: 'D' + | | + | o 2: 'C' + |/ + | o 1: 'B' + |/ + o 0: 'A' + + $ hg rebase -s 1 -d 5 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 5: 'B' + | + o 4: 'F' + | + | o 3: 'E' + |/| + o | 2: 'D' + | | + | o 1: 'C' + |/ + o 0: 'A' + + $ cd .. + + +B onto D - intermediate point: + + $ hg clone -q -u . a a2 + $ cd a2 + + $ hg rebase -s 1 -d 3 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 5: 'B' + | + | o 4: 'F' + |/ + | o 3: 'E' + |/| + o | 2: 'D' + | | + | o 1: 'C' + |/ + o 0: 'A' + + $ cd .. + + +C onto F - skip of E: + + $ hg clone -q -u . a a3 + $ cd a3 + + $ hg rebase -s 2 -d 5 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 4: 'C' + | + o 3: 'F' + | + o 2: 'D' + | + | o 1: 'B' + |/ + o 0: 'A' + + $ cd .. + + +D onto C - rebase of a branching point (skip E): + + $ hg clone -q -u . a a4 + $ cd a4 + + $ hg rebase -s 3 -d 2 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 4: 'F' + | + o 3: 'D' + | + o 2: 'C' + | + | o 1: 'B' + |/ + o 0: 'A' + + $ cd .. + + +E onto F - merged revision having a parent in ancestors of target: + + $ hg clone -q -u . a a5 + $ cd a5 + + $ hg rebase -s 4 -d 5 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 5: 'E' + |\ + | o 4: 'F' + | | + | o 3: 'D' + | | + o | 2: 'C' + |/ + | o 1: 'B' + |/ + o 0: 'A' + + $ cd .. + + +D onto B - E maintains C as parent: + + $ hg clone -q -u . a a6 + $ cd a6 + + $ hg rebase -s 3 -d 1 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + @ 5: 'F' + | + | o 4: 'E' + |/| + o | 3: 'D' + | | + | o 2: 'C' + | | + o | 1: 'B' + |/ + o 0: 'A' + + $ cd .. + + +These will fail (using --source): + +E onto D - rebase onto an ancestor: + + $ hg clone -q -u . a a7 + $ cd a7 + + $ hg rebase -s 4 -d 3 + abort: source is descendant of destination + [255] + +D onto E - rebase onto a descendant: + + $ hg rebase -s 3 -d 4 + abort: source is ancestor of destination + [255] + +E onto B - merge revision with both parents not in ancestors of target: + + $ hg rebase -s 4 -d 1 + abort: cannot use revision 4 as base, result would have 3 parents + [255] + + +These will abort gracefully (using --base): + +E onto E - rebase onto same changeset: + + $ hg rebase -b 4 -d 4 + nothing to rebase + [1] + +E onto D - rebase onto an ancestor: + + $ hg rebase -b 4 -d 3 + nothing to rebase + [1] + +D onto E - rebase onto a descendant: + + $ hg rebase -b 3 -d 4 + nothing to rebase + [1] +