diff --git a/tests/test-rebase-abort.out b/tests/test-rebase-abort.out deleted file mode 100644 --- a/tests/test-rebase-abort.out +++ /dev/null @@ -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 --git a/tests/test-rebase-abort b/tests/test-rebase-abort.t old mode 100755 new mode 100644 rename from tests/test-rebase-abort rename to tests/test-rebase-abort.t --- a/tests/test-rebase-abort +++ b/tests/test-rebase-abort.t @@ -1,76 +1,148 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH + + $ hg init a + $ cd a + + $ echo c1 > common + $ hg add common + $ hg ci -m C1 -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 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 'c2' >>common - hg commit -d '1 0' -m "C2" + $ hg tglog + @ 4: 'L2' + | + o 3: 'L1' + | + | o 2: 'C3' + |/ + o 1: 'C2' + | + o 0: 'C1' + - echo 'c3' >>common - hg commit -d '2 0' -m "C3" +Conflicting rebase: - hg update -C 1 - echo 'l1' >>extra - hg add extra - hg commit -d '3 0' -m "L1" + $ 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 - 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' + $ hg tglog + @ 4: 'L2' + | + o 3: 'L1' + | + | o 2: 'C3' + |/ + o 1: 'C2' + | + o 0: 'C1' + + $ cd .. -echo -echo '% Conflicting rebase' -hg --config extensions.hgext.rebase= rebase -s 3 -d 2 | cleanrebase + +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 -echo '% Abort' -hg --config extensions.hgext.rebase= rebase --abort | cleanrebase + $ echo c > c + $ hg ci -Am C + adding c + + $ hg up -q 0 -hg --config extensions.hgext.graphlog= glog --template '{rev}: {desc}\n' + $ 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: -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' + $ 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] -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 tglog + @ 4: 'C1' + | + o 3: 'B bis' + | + | @ 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg rebase -a + rebase aborted -hg --config extensions.hgext.graphlog= glog --template '{rev}:{desc|short}\n' - -hg rebase -a | cleanrebase -hg glog --template '{rev}:{desc|short}\n' - + $ hg tglog + @ 4: 'C1' + | + o 3: 'B bis' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + diff --git a/tests/test-rebase-cache.out b/tests/test-rebase-cache.out deleted file mode 100644 --- a/tests/test-rebase-cache.out +++ /dev/null @@ -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 --git a/tests/test-rebase-cache b/tests/test-rebase-cache.t old mode 100755 new mode 100644 rename from tests/test-rebase-cache rename to tests/test-rebase-cache.t --- a/tests/test-rebase-cache +++ b/tests/test-rebase-cache.t @@ -1,106 +1,257 @@ -#!/bin/sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > theads = heads --template "{rev}: '{desc}' {branches}\n" + > EOF -. $TESTDIR/helpers.sh + $ hg init a + $ cd a -createrepo() { - rm -rf repo - hg init repo - cd repo + $ echo a > a + $ hg ci -Am A + adding a - echo "a" > a - hg commit -d '0 0' -A -m '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 branch1 - hg commit -d '1 0' -m 'Branch1' + $ hg branch branch2 + marked working directory as branch branch2 + $ hg ci -m 'branch2' - echo "b" > b - hg commit -A -d '2 0' -m 'B' + $ echo c > C + $ hg ci -Am C + adding C + + $ hg up -q 2 - hg up 0 - hg branch branch2 - hg commit -d '3 0' -m 'Branch2' + $ hg branch -f branch2 + marked working directory as branch branch2 + $ echo d > d + $ hg ci -Am D + adding d + created new head - echo "c" > C - hg commit -A -d '4 0' -m 'C' + $ 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' - hg up 2 - hg branch -f branch2 - echo "d" > d - hg commit -A -d '5 0' -m 'D' + $ echo f > f + $ hg ci -Am F + adding f + + $ cd .. - echo "e" > e - hg commit -A -d '6 0' -m 'E' + +Rebase part of branch2 (5-6) onto branch3 (8): - hg update default + $ hg clone -q -u . a a1 + $ cd a1 - hg branch branch3 - hg commit -d '7 0' -m 'Branch3' - - echo "f" > f - hg commit -A -d '8 0' -m 'F' -} + $ 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) -echo -createrepo > /dev/null 2>&1 -hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' + $ 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) -echo -echo '% Branches' -hg branches + $ 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' -echo -echo '% Heads' -hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n' + $ 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 .. -echo -echo '% Rebase part of branch2 (5-6) onto branch3 (8)' -hg --config extensions.hgext.rebase= rebase --detach -s 5 -d 8 | hidebackup + +Rebase head of branch3 (8) onto branch2 (6): -echo -echo '% Branches' -hg branches + $ hg clone -q -u . a a2 + $ cd a2 -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 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) -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 branches + branch2 8:e1e80ed73210 + branch3 7:75fd7b643dce + branch1 2:9d931918fcf7 (inactive) + default 0:1994f17a630e (inactive) -hg --config extensions.hgext.rebase= rebase --detach -s 8 -d 6 | hidebackup + $ hg theads + 8: 'F' branch2 + 7: 'branch3' branch3 + 4: 'C' branch2 + 2: 'B' branch1 + 0: 'A' -echo -echo '% Branches' -hg branches + $ 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 -echo -echo '% Heads' -hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n' + $ cd .. + -echo -hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' -hg verify -q +Rebase entire branch3 (7-8) onto branch2 (6): + + $ hg clone -q -u . a a3 + $ cd a3 -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 + $ 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) -echo -echo '% Branches' -hg branches + $ 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' -echo -echo '% Heads' -hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n' + $ 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 -echo -hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' -hg verify -q diff --git a/tests/test-rebase-check-restore.out b/tests/test-rebase-check-restore.out deleted file mode 100644 --- a/tests/test-rebase-check-restore.out +++ /dev/null @@ -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 --git a/tests/test-rebase-check-restore b/tests/test-rebase-check-restore.t old mode 100755 new mode 100644 rename from tests/test-rebase-check-restore rename to tests/test-rebase-check-restore.t --- a/tests/test-rebase-check-restore +++ b/tests/test-rebase-check-restore.t @@ -1,70 +1,142 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH + + $ hg init a + $ cd a + + $ echo A > A + $ hg add A + $ hg ci -m A -BASE=`pwd` + $ echo 'B' > B + $ hg add B + $ hg ci -m B + + $ echo C >> A + $ hg ci -m C -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} + $ 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 -commit () { - hg commit -d "${2} 0" -m $1 -} + $ 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 -createrepo () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 - echo "C" >> A - commit "C" 2 + $ 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] - hg update -C 0 - echo "D" >> A - commit "D" 3 - addcommit "E" 4 +Solve the conflict and go on: - hg update -C 0 - hg branch 'notdefault' - echo "F" >> A - commit "F" 5 -} + $ echo 'conflict solved' > A + $ rm A.orig + $ hg resolve -m A + $ hg rebase --continue -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 + $ 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 -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' + $ 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] -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 +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) -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 + $ hg tglog + @ 5: 'F' notdefault + | + o 4: 'E' + | + o 3: 'D' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + diff --git a/tests/test-rebase-collapse.out b/tests/test-rebase-collapse.out deleted file mode 100644 --- a/tests/test-rebase-collapse.out +++ /dev/null @@ -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 --git a/tests/test-rebase-collapse b/tests/test-rebase-collapse.t old mode 100755 new mode 100644 rename from tests/test-rebase-collapse rename to tests/test-rebase-collapse.t --- a/tests/test-rebase-collapse +++ b/tests/test-rebase-collapse.t @@ -1,177 +1,441 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH +Create repo a: -BASE=`pwd` + $ hg init a + $ cd a -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} + $ 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 -commit () { - hg commit -d "${2} 0" -m $1 -} + $ 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 -createrepo () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 - addcommit "C" 2 - addcommit "D" 3 + $ 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 update -C 0 - addcommit "E" 4 - - hg update -C 0 - addcommit "F" 5 + $ 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 - hg merge -r 4 - commit "G" 6 + $ cd .. - hg update -C 5 - addcommit "H" 7 -} + +Rebasing G onto H: -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 + $ hg clone -q -u . a a2 + $ cd a2 + + $ hg rebase --base 6 --collapse + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -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 + $ 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) -createrepocomplex () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 + $ 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 - hg up 0 - addcommit "C" 2 - hg merge - commit "D" 3 + $ 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 up 1 - addcommit "E" 4 - - addcommit "F" 5 - - hg merge - commit "G" 6 + $ 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 .. - hg up 0 - addcommit "H" 7 -} + +Rebase and collapse - more than one external (fail): + + $ hg clone -q -u . b b1 + $ cd b1 -echo -createrepocomplex > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' + $ hg rebase -s 2 --collapse + abort: unable to collapse, there is more than one external parent + [255] + +Rebase and collapse - E onto H: -echo -echo '% Rebase and collapse - more than one external (fail)' -hg rebase -s 2 --collapse + $ hg rebase -s 4 --collapse + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -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 + $ 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 -createrepocomplex () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 + $ 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) - hg up 0 - addcommit "C" 2 - hg merge - commit "D" 3 + $ echo D > D + $ hg ci -Am D + adding D + + $ hg up -q 1 - hg up 1 - addcommit "E" 4 - - echo "F" > E - commit "F" 5 + $ 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 - addcommit "G" 6 - - hg merge - commit "H" 7 + $ echo I > I + $ hg ci -Am I + adding I + created new head - hg up 0 - addcommit "I" 8 -} + $ 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 .. -echo -createrepocomplex > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' + +Rebase and collapse - E onto I: + + $ hg clone -q -u . c c1 + $ cd c1 -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 + $ hg rebase -s 4 --collapse + merging E + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -echo 'Cat E:' -cat E + $ 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 -createrepocomplex () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 + $ cat E + F + + $ cd .. + + +Create repo d: + + $ hg init d + $ cd d - addcommit "C" 2 - hg up 1 + $ 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 - addcommit "D" 3 - - hg merge - commit "E" 4 + $ 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 up 0 - addcommit "F" 5 -} + $ hg ci -m E + + $ hg up -q 0 + + $ echo F > F + $ hg ci -Am F + adding F + created new head -echo -createrepocomplex > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' + $ 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 -echo -echo '% Rebase and collapse - B onto F' -hg rebase -s 1 --collapse | hidebackup + $ hg rebase -s 1 --collapse + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -hg glog --template '{rev}: {desc}\n' + $ hg tglog + @ 2: 'Collapsed revision + | * B + | * C + | * D + | * E' + o 1: 'F' + | + o 0: 'A' + + $ hg manifest + A + B + C + D + F -echo "Expected A, B, C, D, F" -hg manifest -exit 0 diff --git a/tests/test-rebase-conflicts.out b/tests/test-rebase-conflicts.out deleted file mode 100644 --- a/tests/test-rebase-conflicts.out +++ /dev/null @@ -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 --git a/tests/test-rebase-conflicts b/tests/test-rebase-conflicts.t old mode 100755 new mode 100644 rename from tests/test-rebase-conflicts rename to tests/test-rebase-conflicts.t --- a/tests/test-rebase-conflicts +++ b/tests/test-rebase-conflicts.t @@ -1,74 +1,115 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH + $ 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 commit -d '0 0' -m "C1" + $ hg init a + $ cd a + $ echo c1 >common + $ hg add common + $ hg ci -m C1 + + $ echo c2 >>common + $ hg ci -m C2 -echo 'c2' >>common -hg commit -d '1 0' -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 -echo 'c3' >>common -hg commit -d '2 0' -m "C3" + $ sed -e 's/c2/l2/' common > common.new + $ mv common.new common + $ hg ci -m L2 -hg update -C 1 -echo 'l1' >>extra -hg add extra -hg commit -d '3 0' -m "L1" + $ echo l3 >> extra2 + $ hg add extra2 + $ hg ci -m L3 -sed -e 's/c2/l2/' common > common.new -mv common.new common -hg commit -d '4 0' -m "L2" + $ hg tglog + @ 5: 'L3' + | + o 4: 'L2' + | + o 3: 'L1' + | + | o 2: 'C3' + |/ + o 1: 'C2' + | + o 0: 'C1' + +Try to call --continue: -echo 'l3' >> extra2 -hg add extra2 -hg commit -d '5 0' -m "L3" + $ hg rebase --continue + abort: no rebase in progress + [255] -hg glog --template '{rev}: {desc}\n' +Conflicting rebase: -echo -echo '% Try to call --continue' -hg rebase --continue + $ 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] -echo -echo '% Conflicting rebase' -hg rebase -s 3 -d 2 +Try to continue without solving the conflict: -echo -echo '% Try to continue without solving the conflict' -hg rebase --continue + $ hg rebase --continue + abort: unresolved merge conflicts (see hg resolve) + [255] -echo -echo '% Conclude rebase' -echo 'resolved merge' >common -hg resolve -m common -hg rebase --continue | cleanrebase +Conclude rebase: -hg glog --template '{rev}: {desc}\n' + $ echo 'resolved merge' >common + $ hg resolve -m common + $ hg rebase --continue + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -echo -echo '% Check correctness' -echo ' - Rev. 0' -hg cat -r 0 common + $ hg tglog + @ 5: 'L3' + | + o 4: 'L2' + | + o 3: 'L1' + | + o 2: 'C3' + | + o 1: 'C2' + | + o 0: 'C1' + +Check correctness: -echo ' - Rev. 1' -hg cat -r 1 common + $ hg cat -r 0 common + c1 -echo ' - Rev. 2' -hg cat -r 2 common + $ hg cat -r 1 common + c1 + c2 -echo ' - Rev. 3' -hg cat -r 3 common + $ hg cat -r 2 common + c1 + c2 + c3 -echo ' - Rev. 4' -hg cat -r 4 common + $ hg cat -r 3 common + c1 + c2 + c3 -echo ' - Rev. 5' -hg cat -r 5 common + $ hg cat -r 4 common + resolved merge + + $ hg cat -r 5 common + resolved merge + diff --git a/tests/test-rebase-detach.out b/tests/test-rebase-detach.out deleted file mode 100644 --- a/tests/test-rebase-detach.out +++ /dev/null @@ -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 --git a/tests/test-rebase-detach b/tests/test-rebase-detach.t old mode 100755 new mode 100644 rename from tests/test-rebase-detach rename to tests/test-rebase-detach.t --- a/tests/test-rebase-detach +++ b/tests/test-rebase-detach.t @@ -1,70 +1,193 @@ -#!/bin/sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF -. $TESTDIR/helpers.sh -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH + $ hg init a + $ cd a + + $ echo A > A + $ hg ci -Am A + adding A + + $ echo B > B + $ hg ci -Am B + adding B -BASE=`pwd` + $ echo C > C + $ hg ci -Am C + adding C + + $ echo D > D + $ hg ci -Am D + adding D + + $ hg up -q -C 0 -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} + $ 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 -commit () { - hg commit -d "${2} 0" -m $1 -} + $ 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) -createrepo () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 - addcommit "C" 2 - addcommit "D" 3 + $ hg tglog + @ 4: 'D' + | + o 3: 'E' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg manifest + A + D + E + + $ cd .. + - hg update -C 0 - addcommit "E" 4 -} +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) -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 + $ hg tglog + @ 4: 'D' + | + o 3: 'C' + | + o 2: 'E' + | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg manifest + A + C + D + E + + $ cd .. -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 + +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) -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 + $ 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 -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 + $ 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) -exit 0 + $ hg tglog + @ 3: 'Collapsed revision + | * C + | * D' + o 2: 'E' + | + | o 1: 'B' + |/ + o 0: 'A' + + $ hg manifest + A + C + D + E + + $ cd .. + diff --git a/tests/test-rebase-interruptions.out b/tests/test-rebase-interruptions.out deleted file mode 100644 --- a/tests/test-rebase-interruptions.out +++ /dev/null @@ -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 --git a/tests/test-rebase-interruptions b/tests/test-rebase-interruptions.t old mode 100755 new mode 100644 rename from tests/test-rebase-interruptions rename to tests/test-rebase-interruptions.t --- a/tests/test-rebase-interruptions +++ b/tests/test-rebase-interruptions.t @@ -1,83 +1,194 @@ -#!/bin/sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF + -. $TESTDIR/helpers.sh -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH + $ hg init a + $ cd a -BASE=`pwd` + $ echo A > A + $ hg ci -Am A + adding A + + $ echo B > B + $ hg ci -Am B + adding B -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} + $ echo C >> A + $ hg ci -m C + + $ hg up -q -C 0 + + $ echo D >> A + $ hg ci -m D + created new head -commit () { - hg commit -d "${2} 0" -m $1 -} + $ echo E > E + $ hg ci -Am E + adding E + + $ cd .. + + +Changes during an interruption - continue: + + $ hg clone -q -u . a a1 + $ cd a1 -createrepo () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 - echo "C" >> A - commit "C" 2 + $ 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 - hg update -C 0 - echo "D" >> A - commit "D" 3 - addcommit "E" 4 -} + $ echo 'Extra' > Extra + $ hg add Extra + $ hg ci -m 'Extra' -echo "% Changes during an interruption - continue" -createrepo > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' + $ 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 -echo "% - Rebasing B onto E" -hg rebase -s 1 -d 4 | hidebackup + $ echo 'conflict solved' > A + $ rm A.orig + $ hg resolve -m A -echo -echo "% - Force a commit on C during the interruption" -hg update -C 2 -addcommit "Extra" 5 -hg glog --template '{rev}: {desc}\n' + $ hg rebase --continue + warning: new changesets detected on source branch, not stripping -echo -echo "% - Resume the rebasing" -hg rebase --continue + $ 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 .. -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' + +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: -echo -echo -echo "% Changes during an interruption - abort" -createrepo > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' + $ 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] -echo -echo "% Rebasing B onto E" -hg rebase -s 1 -d 4 | hidebackup +Force a commit on B' during the interruption: + + $ hg up -q -C 5 + + $ echo 'Extra' > Extra + $ hg add Extra + $ hg ci -m 'Extra' -echo -echo "% Force a commit on B' during the interruption" -hg update -C 5 -addcommit "Extra" 6 -hg glog --template '{rev}: {desc}\n' + $ 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: -echo -echo "% Abort the rebasing" -hg rebase --abort -hg glog --template '{rev}: {desc}\n' + $ hg rebase --abort + warning: new changesets detected on target branch, can't abort + [255] -exit 0 + $ hg tglog + @ 6: 'Extra' + | + o 5: 'B' + | + o 4: 'E' + | + o 3: 'D' + | + | o 2: 'C' + | | + | o 1: 'B' + |/ + o 0: 'A' + + $ cd .. + diff --git a/tests/test-rebase-issue-noparam-single-rev.out b/tests/test-rebase-issue-noparam-single-rev.out deleted file mode 100644 --- a/tests/test-rebase-issue-noparam-single-rev.out +++ /dev/null @@ -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 --git a/tests/test-rebase-issue-noparam-single-rev b/tests/test-rebase-issue-noparam-single-rev.t old mode 100755 new mode 100644 rename from tests/test-rebase-issue-noparam-single-rev rename to tests/test-rebase-issue-noparam-single-rev.t --- a/tests/test-rebase-issue-noparam-single-rev +++ b/tests/test-rebase-issue-noparam-single-rev.t @@ -1,51 +1,123 @@ -#!/bin/sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF -. $TESTDIR/helpers.sh + + $ hg init a + $ cd a -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH + $ 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 -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} + $ echo r1 > r1 + $ hg ci -Am r1 + adding r1 + created new head + + $ echo r2 > r2 + $ hg ci -Am r2 + adding r2 -hg init a -cd a -addcommit "c1" 0 -addcommit "c2" 1 + $ 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: -addcommit "l1" 2 + $ hg up -q -C 2 -hg update -C 1 -addcommit "r1" 3 -addcommit "r2" 4 -hg glog --template '{rev}:{desc}\n' + $ hg rebase + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -echo -echo '% Rebase with no arguments - single revision in source branch' -hg update -C 2 -hg rebase | hidebackup -hg glog --template '{rev}:{desc}\n' + $ hg tglog + @ 4: 'l1' + | + o 3: 'r2' + | + o 2: 'r1' + | + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. + + + $ hg init b + $ cd b -cd .. -rm -rf a -hg init a -cd a -addcommit "c1" 0 -addcommit "c2" 1 + $ 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 -addcommit "l1" 2 -addcommit "l2" 3 + $ echo r1 > r1 + $ hg ci -Am r1 + adding r1 + created new head -hg update -C 1 -addcommit "r1" 4 -hg glog --template '{rev}:{desc}\n' + $ 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 -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' + $ 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 --git a/tests/test-rebase-keep-branch.out b/tests/test-rebase-keep-branch.out deleted file mode 100644 --- a/tests/test-rebase-keep-branch.out +++ /dev/null @@ -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 --git a/tests/test-rebase-keep-branch b/tests/test-rebase-keep-branch.t old mode 100755 new mode 100644 rename from tests/test-rebase-keep-branch rename to tests/test-rebase-keep-branch.t --- a/tests/test-rebase-keep-branch +++ b/tests/test-rebase-keep-branch.t @@ -1,32 +1,71 @@ -#!/bin/sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH + + $ hg init a + $ cd a + + $ echo c1 > c1 + $ hg ci -Am c1 + adding c1 -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} + $ 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 -hg init a -cd a -addcommit "c1" 0 -addcommit "c2" 1 + $ echo r1 > r1 + $ hg ci -Am r1 + adding r1 -addcommit "l1" 2 -addcommit "l2" 3 + $ 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 update -C 1 -hg branch 'notdefault' -addcommit "r1" 4 -hg glog --template '{rev}:{desc}:{branches}\n' + $ hg up -q -C 3 + + $ hg rebase -b 4 -d 3 --keepbranches + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -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 + $ hg tglog + @ 4: 'r1' notdefault + | + o 3: 'l2' + | + o 2: 'l1' + | + o 1: 'c2' + | + o 0: 'c1' + + $ hg branch + notdefault + diff --git a/tests/test-rebase-mq-skip.out b/tests/test-rebase-mq-skip.out deleted file mode 100644 --- a/tests/test-rebase-mq-skip.out +++ /dev/null @@ -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 --git a/tests/test-rebase-mq-skip b/tests/test-rebase-mq-skip.t old mode 100755 new mode 100644 rename from tests/test-rebase-mq-skip rename to tests/test-rebase-mq-skip.t --- a/tests/test-rebase-mq-skip +++ b/tests/test-rebase-mq-skip.t @@ -1,76 +1,136 @@ -#!/bin/sh -# This emulates the effects of an hg pull --rebase in which the remote repo -# already has one local mq patch +This emulates the effects of an hg pull --rebase in which the remote repo +already has one local mq patch -. $TESTDIR/helpers.sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > mq= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n" + > EOF + -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH -echo "mq=" >> $HGRCPATH + $ hg init a + $ cd a + $ hg qinit -c + + $ echo c1 > c1 + $ hg add c1 + $ hg ci -m C1 -hg init a -cd a -hg qinit -c # This must work even with a managed mq queue + $ 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 -echo 'c1' > c1 -hg add c1 -hg commit -d '0 0' -m "C1" + $ hg qnew p1.patch + $ echo p1 > p1 + $ hg add p1 + $ hg qref -m P1 + + $ hg export qtip > p1.patch -echo 'r1' > r1 -hg add r1 -hg commit -d '1 0' -m "R1" + $ hg up -q -C 1 + + $ hg import p1.patch + applying p1.patch + + $ rm p1.patch + + $ hg up -q -C qtip -hg up 0 -hg qnew p0.patch -echo 'p0' > p0 -hg add p0 -hg qref -m 'P0' + $ hg rebase + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -hg qnew p1.patch -echo 'p1' > p1 -hg add p1 -hg qref -m 'P1' -hg export qtip > p1.patch + $ 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 -echo -echo '% "Mainstream" import p1.patch' -hg up -C 1 -hg import p1.patch -rm p1.patch + $ 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 -echo -echo '% Rebase' -hg up -C qtip -hg rebase | hidebackup -hg glog --template '{rev} {desc} tags: {tags}\n' + $ hg up -q 0 -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 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 -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 + $ 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 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' + $ 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 --git a/tests/test-rebase-mq.out b/tests/test-rebase-mq.out deleted file mode 100644 --- a/tests/test-rebase-mq.out +++ /dev/null @@ -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 --git a/tests/test-rebase-mq b/tests/test-rebase-mq.t old mode 100755 new mode 100644 rename from tests/test-rebase-mq rename to tests/test-rebase-mq.t --- a/tests/test-rebase-mq +++ b/tests/test-rebase-mq.t @@ -1,133 +1,237 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > mq= + > + > [mq] + > plain=true + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n" + > EOF -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH -echo "mq=" >> $HGRCPATH + + $ hg init a + $ cd a + $ hg qinit -c -echo "[mq]" >> $HGRCPATH -echo "plain=true" >> $HGRCPATH + $ echo c1 > f + $ hg add f + $ hg ci -m C1 + + $ echo r1 > f + $ hg ci -m R1 + + $ hg up -q 0 -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 qnew f.patch + $ echo mq1 > f + $ hg qref -m P0 + + $ hg qnew f2.patch + $ echo mq2 > f + $ hg qref -m P1 -hg init a -cd a -hg qinit -c # This must work even with a managed mq queue + $ 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: -echo 'c1' > f -hg add f -hg commit -d '0 0' -m "C1" + $ 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 -echo 'r1' > f -hg commit -d '2 0' -m "R1" +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: -hg up 0 -hg qnew f.patch -echo 'mq1' > f -hg qref -m 'P0' + $ 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] -hg qnew f2.patch -echo 'mq2' > f -hg qref -m 'P1' -hg glog --template '{rev} {desc} tags: {tags}\n' +Fix the 2nd conflict: + + $ echo mq1r1mq2 > f + $ hg resolve -m f + $ hg rebase -c + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -echo -echo '% Rebase - try to rebase on an applied mq patch' -hg rebase -s 1 -d 3 + $ 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 -echo -echo '% Rebase - same thing, but mq patch is default dest' -hg update -q 1 -hg rebase -hg update -q qtip + $ cat f + mq1r1 -echo -echo '% Rebase - generate a conflict' -hg rebase -s 2 -d 1 + $ 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 -echo -echo '% Fix the 1st conflict' -echo 'mq1r1' > f -hg resolve -m f -hg rebase -c | hidebackup +Update to qtip: + + $ hg up -q qtip -echo -echo '% Fix the 2nd conflict' -echo 'mq1r1mq2' > f -hg resolve -m f -hg rebase -c | hidebackup + $ cat f + mq1r1mq2 -hg glog --template '{rev} {desc} tags: {tags}\n' + $ 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 -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 + $ 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)' -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 + $ hg qnew f.patch + $ echo mq2 > p + $ hg qref -m P1 + $ hg qci -m 'save patch state' -echo -echo '% Adding one git-style patch and one normal' -hg qpop -a -rm -fr .hg/patches -hg qinit -c + $ hg qseries -s + f_git.patch: P0 (git) + f.patch: P1 + + $ hg -R .hg/patches manifest + .hgignore + f.patch + f_git.patch + series -hg up 0 -hg qnew --git f_git.patch -echo 'mq1' > p -hg add p -hg qref --git -m 'P0 (git)' + $ 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 -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 + $ cat .hg/patches/f.patch + P1 + + diff -r ???????????? p (glob) + --- a/p ??? ??? ?? ??:??:?? ???? ????? (glob) + +++ b/p ??? ??? ?? ??:??:?? ???? ????? (glob) + @@ -1,1 +1,1 @@ + -mq1 + +mq2 + -echo '% Git patch' -cat .hg/patches/f_git.patch | filterpatch +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 -echo -echo '% Normal patch' -cat .hg/patches/f.patch | filterpatch + $ hg -R .hg/patches manifest + .hgignore + f.patch + f_git.patch + series -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 + $ 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 -echo '% And the patches are correct' -echo '% Git patch' -cat .hg/patches/f_git.patch | filterpatch + $ 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 -echo -echo '% Normal patch' -cat .hg/patches/f.patch | filterpatch - diff --git a/tests/test-rebase-newancestor.out b/tests/test-rebase-newancestor.out deleted file mode 100644 --- a/tests/test-rebase-newancestor.out +++ /dev/null @@ -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 --git a/tests/test-rebase-newancestor b/tests/test-rebase-newancestor.t old mode 100755 new mode 100644 rename from tests/test-rebase-newancestor rename to tests/test-rebase-newancestor.t --- a/tests/test-rebase-newancestor +++ b/tests/test-rebase-newancestor.t @@ -1,33 +1,54 @@ -#!/bin/sh - -. $TESTDIR/helpers.sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH + $ hg init repo + $ cd repo -rm -rf repo -hg init repo -cd repo + $ echo A > a + $ echo >> a + $ hg ci -Am A + adding a -echo A > a -echo >> a -hg commit -AmA -u test -d '0 0' + $ echo B > a + $ echo >> a + $ hg ci -m B + + $ echo C > a + $ echo >> a + $ hg ci -m C + + $ hg up -q -C 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' + $ echo D >> a + $ hg ci -Am AD + created new head -hg up -C 0 -echo D >> a -hg commit -AmAD -u test -d '3 0' + $ 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 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 + $ hg tglog + @ 3: 'C' + | + o 2: 'B' + | + o 1: 'AD' + | + o 0: 'A' + diff --git a/tests/test-rebase-parameters.out b/tests/test-rebase-parameters.out deleted file mode 100644 --- a/tests/test-rebase-parameters.out +++ /dev/null @@ -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 --git a/tests/test-rebase-parameters b/tests/test-rebase-parameters.t old mode 100755 new mode 100644 rename from tests/test-rebase-parameters rename to tests/test-rebase-parameters.t --- a/tests/test-rebase-parameters +++ b/tests/test-rebase-parameters.t @@ -1,110 +1,332 @@ -#!/bin/sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF + + + $ hg init a + $ cd a + + $ echo c1 > c1 + $ hg ci -Am c1 + adding c1 -. $TESTDIR/helpers.sh + $ echo c2 > c2 + $ hg ci -Am c2 + adding c2 + + $ echo c3 > c3 + $ hg ci -Am c3 + adding c3 -echo "[extensions]" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH + $ hg up -q -C 1 + + $ echo l1 > l1 + $ hg ci -Am l1 + adding l1 + created new head + + $ echo l2 > l2 + $ hg ci -Am l2 + adding l2 -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} + $ echo l3 > l3 + $ hg ci -Am l3 + adding l3 + + $ hg up -q -C 2 + + $ echo r1 > r1 + $ hg ci -Am r1 + adding r1 + + $ echo r2 > r2 + $ hg ci -Am r2 + adding r2 -commit () { - hg commit -d "${2} 0" -m $1 -} + $ hg tglog + @ 7: 'r2' + | + o 6: 'r1' + | + | o 5: 'l3' + | | + | o 4: 'l2' + | | + | o 3: 'l1' + | | + o | 2: 'c3' + |/ + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. -createrepo () { - hg init a - cd a - addcommit "c1" 0 - addcommit "c2" 1 - addcommit "c3" 2 + +These fail: + + $ hg clone -q -u . a a1 + $ cd a1 + + $ hg rebase --continue --abort + abort: cannot use both abort and continue + [255] - hg update -C 1 - addcommit "l1" 3 - addcommit "l2" 4 - addcommit "l3" 5 + $ hg rebase --continue --collapse + abort: cannot use collapse with continue or abort + [255] + + $ hg rebase --continue --dest 4 + abort: abort and continue do not allow specifying revisions + [255] + + $ hg rebase --base 5 --source 4 + abort: cannot specify both a revision and a base + [255] + + $ hg rebase + nothing to rebase + [1] - hg update -C 2 - addcommit "r1" 6 - addcommit "r2" 7 -} + $ hg up -q 6 + + $ hg rebase + nothing to rebase + [1] + + +These work: + +Rebase with no arguments (from 3 onto 7): + + $ hg up -q -C 5 + + $ hg rebase + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -createrepo > /dev/null 2>&1 -echo "% These fail" -echo -echo "% Use continue and abort" -hg rebase --continue --abort + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + | + o 5: 'l1' + | + o 4: 'r2' + | + o 3: 'r1' + | + o 2: 'c3' + | + o 1: 'c2' + | + o 0: 'c1' + +Try to rollback after a rebase (fail): + + $ hg rollback + no rollback information available + [1] + + $ cd .. + -echo -echo "% Use continue and collapse" -hg rebase --continue --collapse +Rebase with base == '.' => same as no arguments (from 3 onto 7): + + $ hg clone -q -u 5 a a2 + $ cd a2 + + $ hg rebase --base . + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -echo -echo "% Use continue/abort and dest/source" -hg rebase --continue --dest 4 + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + | + o 5: 'l1' + | + o 4: 'r2' + | + o 3: 'r1' + | + o 2: 'c3' + | + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. -echo -echo "% Use source and base" -hg rebase --base 5 --source 4 -echo -echo "% Rebase with no arguments - from current" -hg rebase +Rebase with dest == `hg branch` => same as no arguments (from 3 onto 7): + + $ hg clone -q -u 5 a a3 + $ cd a3 + + $ hg rebase --dest `hg branch` + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -echo -echo "% Rebase with no arguments - from the current branch" -hg update 6 -hg rebase + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + | + o 5: 'l1' + | + o 4: 'r2' + | + o 3: 'r1' + | + o 2: 'c3' + | + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. + + +Specify only source (from 4 onto 7): + + $ hg clone -q -u . a a4 + $ cd a4 + + $ hg rebase --source 4 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -echo "% ----------" -echo "% These work" -echo -echo "% Rebase with no arguments (from 3 onto 7)" -hg update -C 5 -hg rebase 2>&1 | hidebackup + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + |\ + | o 5: 'r2' + | | + | o 4: 'r1' + | | + o | 3: 'l1' + | | + | o 2: 'c3' + |/ + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. + + +Specify only dest (from 3 onto 6): -echo "% Try to rollback after a rebase (fail)" -hg rollback + $ hg clone -q -u 5 a a5 + $ cd a5 + + $ hg rebase --dest 6 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -createrepo > /dev/null 2>&1 -echo -echo "% Rebase with base == '.' => same as no arguments (from 3 onto 7)" -hg update -C 5 -hg rebase --base . | hidebackup + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + | + o 5: 'l1' + | + | o 4: 'r2' + |/ + o 3: 'r1' + | + o 2: 'c3' + | + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. + -createrepo > /dev/null 2>&1 -echo -echo "% Rebase with dest == `hg branch` => same as no arguments (from 3 onto 7)" -hg update -C 5 -hg rebase --dest `hg branch` | hidebackup +Specify only base (from 3 onto 7): + + $ hg clone -q -u . a a6 + $ cd a6 + + $ hg rebase --base 5 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -createrepo > /dev/null 2>&1 -echo -echo "% Specify only source (from 4 onto 7)" -hg rebase --source 4 | hidebackup + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + | + o 5: 'l1' + | + o 4: 'r2' + | + o 3: 'r1' + | + o 2: 'c3' + | + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. -createrepo > /dev/null 2>&1 -echo -echo "% Specify only dest (from 3 onto 6)" -hg update -C 5 -hg rebase --dest 6 | hidebackup + +Specify source and dest (from 4 onto 6): + + $ hg clone -q -u . a a7 + $ cd a7 + + $ hg rebase --source 4 --dest 6 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -createrepo > /dev/null 2>&1 -echo -echo "% Specify only base (from 3 onto 7)" -hg rebase --base 5 | hidebackup + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + |\ + | | o 5: 'r2' + | |/ + | o 4: 'r1' + | | + o | 3: 'l1' + | | + | o 2: 'c3' + |/ + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. + + +Specify base and dest (from 3 onto 6): -createrepo > /dev/null 2>&1 -echo -echo "% Specify source and dest (from 4 onto 6)" -hg rebase --source 4 --dest 6 | hidebackup + $ hg clone -q -u . a a8 + $ cd a8 + + $ hg rebase --base 4 --dest 6 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -createrepo > /dev/null 2>&1 -echo -echo "% Specify base and dest (from 3 onto 6)" -hg rebase --base 4 --dest 6 | hidebackup + $ hg tglog + @ 7: 'l3' + | + o 6: 'l2' + | + o 5: 'l1' + | + | o 4: 'r2' + |/ + o 3: 'r1' + | + o 2: 'c3' + | + o 1: 'c2' + | + o 0: 'c1' + + $ cd .. -exit 0 diff --git a/tests/test-rebase-pull.out b/tests/test-rebase-pull.out deleted file mode 100644 --- a/tests/test-rebase-pull.out +++ /dev/null @@ -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 --git a/tests/test-rebase-pull b/tests/test-rebase-pull.t old mode 100755 new mode 100644 rename from tests/test-rebase-pull rename to tests/test-rebase-pull.t --- a/tests/test-rebase-pull +++ b/tests/test-rebase-pull.t @@ -1,63 +1,113 @@ -#!/bin/sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF -. $TESTDIR/helpers.sh -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH + $ hg init a + $ cd a -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} + $ echo C1 > C1 + $ hg ci -Am C1 + adding C1 + + $ echo C2 > C2 + $ hg ci -Am C2 + adding C2 + + $ cd .. -commit () { - hg commit -d "${2} 0" -m $1 -} + $ 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 -rm -rf a -hg init a -cd a -addcommit "C1" 0 -addcommit "C2" 1 + $ echo L1 > L1 + $ hg ci -Am L1 + adding L1 + + + $ cd ../a -cd .. -hg clone a b -# This is needed to test pull --rebase -hg clone a c + $ echo R1 > R1 + $ hg ci -Am R1 + adding R1 -cd b -addcommit "L1" 2 + + $ cd ../b + +Now b has one revision to be pulled from a: -cd ../a -addcommit "R1" 3 + $ 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) -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 tglog + @ 3: 'L1' + | + o 2: 'R1' + | + o 1: 'C2' + | + o 0: 'C1' + +Re-run: -hg glog --template '{rev}:{desc}\n' + $ hg pull --rebase + pulling from */a (glob) + searching for changes + no changes found -echo -echo "% Re-run pull --rebase" -hg pull --rebase | sed 's/\(pulling from \).*/\1/' + +Invoke pull --rebase and nothing to rebase: + + $ cd ../c -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 + $ 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: -echo -echo "% pull --rebase --update should ignore --update" -hg pull --rebase --update 2>&1 | sed 's/\(pulling from \).*/\1/' + $ 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 -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 + $ hg pull --rebase + pulling from */a (glob) + searching for changes + no changes found -exit 0 + $ hg tglog -l 1 + o 2: 'R1' + | + diff --git a/tests/test-rebase-rename.out b/tests/test-rebase-rename.out deleted file mode 100644 --- a/tests/test-rebase-rename.out +++ /dev/null @@ -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 --git a/tests/test-rebase-rename b/tests/test-rebase-rename.t old mode 100755 new mode 100644 rename from tests/test-rebase-rename rename to tests/test-rebase-rename.t --- a/tests/test-rebase-rename +++ b/tests/test-rebase-rename.t @@ -1,55 +1,121 @@ -#!/bin/sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tlog = log --template "{rev}: '{desc}' {branches}\n" + > tglog = tlog --graph + > EOF -. $TESTDIR/helpers.sh + + $ hg init a + $ cd a -echo "[extensions]" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH -echo "[diff]" >> $HGRCPATH -echo "git=1" >> $HGRCPATH + $ echo a > a + $ hg ci -Am A + adding a -BASE=`pwd` + $ 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 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' + $ hg tglog + @ 2: 'rename A' + | + | o 1: 'B' + |/ + o 0: 'A' + + +Rename is tracked: -echo -echo '% Rename is tracked' -hg log -p -r tip --template '{rev}:{desc}\n' + $ 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: -echo '% Rebase the revision containing the rename' -hg rebase -s 2 -d 1 --quiet | cleanrebase + $ 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: -echo -echo '% Rename is not lost' -hg log -p -r tip --template '{rev}:{desc}\n' + $ 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 -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' + $ 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: -echo -echo '% Copy is tracked' -hg log -p -r tip --template '{rev}:{desc}\n' + $ hg rebase -s 2 -d 1 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -echo '% Rebase the revision containing the copy' -hg rebase -s 2 -d 1 --quiet | cleanrebase + $ hg tglog + @ 2: 'copy A' + | + o 1: 'B' + | + o 0: 'A' + +Copy is not lost: -echo -echo '% Copy is not lost' -hg log -p -r tip --template '{rev}:{desc}\n' - + $ hg tlog -p --git -r tip + 2: 'copy A' + diff --git a/a b/a-copied + copy from a + copy to a-copied + diff --git a/tests/test-rebase-scenario-global.out b/tests/test-rebase-scenario-global.out deleted file mode 100644 --- a/tests/test-rebase-scenario-global.out +++ /dev/null @@ -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 --git a/tests/test-rebase-scenario-global b/tests/test-rebase-scenario-global.t old mode 100755 new mode 100644 rename from tests/test-rebase-scenario-global rename to tests/test-rebase-scenario-global.t --- a/tests/test-rebase-scenario-global +++ b/tests/test-rebase-scenario-global.t @@ -1,93 +1,249 @@ -#!/bin/sh + $ cat >> $HGRCPATH < [extensions] + > graphlog= + > rebase= + > + > [alias] + > tglog = log -G --template "{rev}: '{desc}' {branches}\n" + > EOF -. $TESTDIR/helpers.sh + + $ hg init a + $ cd a -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH -echo "rebase=" >> $HGRCPATH + $ echo A > A + $ hg ci -Am A + adding A -BASE=`pwd` + $ 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 -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} + $ 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 -commit () { - hg commit -d "${2} 0" -m $1 -} + $ 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 -createrepo () { - cd $BASE - rm -rf a - hg init a - cd a - addcommit "A" 0 - addcommit "B" 1 + $ 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 update -C 0 - addcommit "C" 2 + $ hg tglog + @ 5: 'B' + | + o 4: 'F' + | + | o 3: 'E' + |/| + o | 2: 'D' + | | + | o 1: 'C' + |/ + o 0: 'A' + + $ cd .. + - hg update -C 0 - addcommit "D" 3 +B onto D - intermediate point: - hg merge -r 2 - commit "E" 4 + $ 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 update -C 3 - addcommit "F" 5 -} + $ hg tglog + @ 5: 'B' + | + | o 4: 'F' + |/ + | o 3: 'E' + |/| + o | 2: 'D' + | | + | o 1: 'C' + |/ + o 0: 'A' + + $ cd .. -createrepo > /dev/null 2>&1 -hg glog --template '{rev}: {desc}\n' + +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) -echo '% Rebasing' -echo '% B onto F - simple rebase' -hg rebase -s 1 -d 5 | hidebackup -hg glog --template '{rev}: {desc}\n' + $ hg tglog + @ 4: 'C' + | + o 3: 'F' + | + o 2: 'D' + | + | o 1: 'B' + |/ + o 0: 'A' + + $ cd .. -createrepo > /dev/null 2>&1 -echo '% B onto D - intermediate point' -hg rebase -s 1 -d 3 | hidebackup -hg glog --template '{rev}: {desc}\n' + +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) -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' + $ 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 -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' + $ hg rebase -s 4 -d 5 + saved backup bundle to */.hg/strip-backup/*-backup.hg (glob) -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' + $ 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: -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' + $ 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] -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 +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: -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 + $ hg rebase -b 4 -d 4 + nothing to rebase + [1] + +E onto D - rebase onto an ancestor: -exit 0 + $ 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] +