rebase: use helpers.sh in tests

This commit is contained in:
Matt Mackall 2010-05-19 20:20:12 -05:00
parent 0a1ca665ca
commit 1717a658d7
23 changed files with 96 additions and 88 deletions

View File

@ -2,8 +2,16 @@
hideport() { sed "s/localhost:$HGPORT/localhost:\$HGPORT/"; }
repr() { python -c "import sys; print repr(sys.stdin.read()).replace('\\n', '\n')" }
repr() { python -c "import sys; print repr(sys.stdin.read()).replace('\\n', '\n')"; }
hidehex() { python -c 'import sys, re; print re.replace("\b[0-9A-Fa-f]{12,40}", "X" * 12)' }
hidehex() { python -c 'import sys, re; print re.replace("\b[0-9A-Fa-f]{12,40}", "X" * 12)'; }
hidetmp() { sed "s/$HGTMP/\$HGTMP/"; }
hidetmp() { sed "s/$HGTMP/\$HGTMP/"; }
hidebackup() { sed 's/\(saving bundle to \).*/\1/'; }
cleanrebase() {
sed -e 's/\(Rebase status stored to\).*/\1/' \
-e 's/\(Rebase status restored from\).*/\1/' \
-e 's/\(saving bundle to \).*/\1/';
}

View File

@ -1,15 +1,11 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
echo "bookmarks=" >> $HGRCPATH
cleanoutput () {
sed -e 's/\(Rebase status stored to\).*/\1/' \
-e 's/\(Rebase status restored from\).*/\1/' \
-e 's/\(saving bundle to \).*/\1/'
}
echo % initialize repository
hg init
@ -33,6 +29,6 @@ echo % bookmark list
hg bookmark
echo % rebase
hg rebase -s two -d one 2>&1 | cleanoutput
hg rebase -s two -d one 2>&1 | cleanrebase
hg log

View File

@ -1,15 +1,11 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
cleanoutput () {
sed -e 's/\(Rebase status stored to\).*/\1/' \
-e 's/\(Rebase status restored from\).*/\1/' \
-e 's/\(saving bundle to \).*/\1/'
}
hg init a
cd a
echo 'c1' >common
@ -35,10 +31,10 @@ hg glog --template '{rev}: {desc}\n'
echo
echo '% Conflicting rebase'
hg rebase -s 3 -d 2 2>&1 | cleanoutput
hg rebase -s 3 -d 2 | cleanrebase
echo
echo '% Abort'
hg rebase --abort 2>&1 | cleanoutput
hg rebase --abort | cleanrebase
hg glog --template '{rev}: {desc}\n'

View File

@ -12,10 +12,10 @@ o 0: C1
% Conflicting rebase
merging common
warning: conflicts during merge.
merging common failed!
abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
merging common
% Abort
rebase aborted

View File

@ -1,5 +1,7 @@
#!/bin/sh
source $TESTDIR/helpers.sh
createrepo() {
rm -rf repo
hg init repo
@ -52,7 +54,7 @@ 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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg --config extensions.hgext.rebase= rebase --detach -s 5 -d 8 | hidebackup
echo
echo '% Branches'
@ -70,7 +72,7 @@ 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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg --config extensions.hgext.rebase= rebase --detach -s 8 -d 6 | hidebackup
echo
echo '% Branches'
@ -89,7 +91,7 @@ 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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg --config extensions.hgext.rebase= rebase --detach -s 7 -d 6 | hidebackup
echo
echo '% Branches'

View File

@ -1,5 +1,7 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
@ -41,28 +43,28 @@ 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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
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 | sed 's/\(saving bundle to \).*/\1/'
hg rebase --continue 2>&1 | hidebackup
hg glog --template '{rev}:{desc}:{branches}\n'
exit 0

View File

@ -12,10 +12,10 @@
|/
o 0:A:
merging 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
rebase completed
@ -49,10 +49,10 @@ o 0:A:
|/
o 0:A:
merging 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
adding branch

View File

@ -1,5 +1,7 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
@ -43,7 +45,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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase --collapse --keepbranches | hidebackup
hg glog --template '{rev}: {desc}\n'
echo "Expected A, B, C, D, F, H"
hg manifest
@ -51,7 +53,7 @@ hg manifest
createrepo > /dev/null 2>&1
echo
echo '% Rebasing G onto H'
hg rebase --base 6 --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase --base 6 --collapse | hidebackup
hg glog --template '{rev}: {desc}\n'
echo "Expected A, E, F, H"
hg manifest
@ -91,7 +93,7 @@ hg rebase -s 2 --collapse
echo
echo '% Rebase and collapse - E onto H'
hg rebase -s 4 --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase -s 4 --collapse | hidebackup
hg glog --template '{rev}: {desc}\n'
echo "Expected A, B, C, E, F, H"
hg manifest
@ -130,7 +132,7 @@ hg glog --template '{rev}: {desc}\n'
echo
echo '% Rebase and collapse - E onto I'
hg rebase -s 4 --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase -s 4 --collapse | hidebackup
hg glog --template '{rev}: {desc}\n'
@ -166,7 +168,7 @@ hg glog --template '{rev}: {desc}\n'
echo
echo '% Rebase and collapse - B onto F'
hg rebase -s 1 --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase -s 1 --collapse | hidebackup
hg glog --template '{rev}: {desc}\n'

View File

@ -1,15 +1,11 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
cleanoutput () {
sed -e 's/\(Rebase status stored to\).*/\1/' \
-e 's/\(Rebase status restored from\).*/\1/' \
-e 's/\(saving bundle to \).*/\1/'
}
hg init a
cd a
echo 'c1' >common
@ -53,7 +49,7 @@ echo
echo '% Conclude rebase'
echo 'resolved merge' >common
hg resolve -m common
hg rebase --continue 2>&1 | cleanoutput
hg rebase --continue | cleanrebase
hg glog --template '{rev}: {desc}\n'

View File

@ -1,5 +1,7 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
@ -33,7 +35,7 @@ createrepo () {
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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase --detach -s 3 -d 4 | hidebackup
hg glog --template '{rev}: {desc}\n'
echo "Expected A, D, E"
hg manifest
@ -42,7 +44,7 @@ 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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase --detach -s 2 -d 4 | hidebackup
hg glog --template '{rev}: {desc}\n'
echo "Expected A, C, D, E"
hg manifest
@ -51,7 +53,7 @@ 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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase --detach -s 1 -d 4 | hidebackup
hg glog --template '{rev}: {desc}\n'
echo "Expected A, B, C, D, E"
hg manifest
@ -60,7 +62,7 @@ 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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase --detach --collapse -s 2 -d 4 | hidebackup
hg glog --template '{rev}: {desc}\n'
echo "Expected A, C, D, E"
hg manifest

View File

@ -1,5 +1,6 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
@ -38,7 +39,7 @@ hg glog --template '{rev}: {desc}\n'
echo
echo "% - Rebasing B onto E"
hg rebase -s 1 -d 4 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase -s 1 -d 4 | hidebackup
echo
echo "% - Force a commit on C during the interruption"
@ -66,7 +67,7 @@ hg glog --template '{rev}: {desc}\n'
echo
echo "% Rebasing B onto E"
hg rebase -s 1 -d 4 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase -s 1 -d 4 | hidebackup
echo
echo "% Force a commit on B' during the interruption"

View File

@ -11,10 +11,10 @@ o 0: A
% - Rebasing B onto E
merging A
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
@ -73,10 +73,10 @@ o 0: A
% Rebasing B onto E
merging A
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

View File

@ -1,5 +1,7 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
@ -25,7 +27,7 @@ hg glog --template '{rev}:{desc}\n'
echo
echo '% Rebase with no arguments - single revision in source branch'
hg update -C 2
hg rebase 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase | hidebackup
hg glog --template '{rev}:{desc}\n'
cd ..
@ -45,5 +47,5 @@ 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 | sed 's/\(saving bundle to \).*/\1/'
hg rebase 2>&1 | hidebackup
hg glog --template '{rev}:{desc}\n'

View File

@ -26,7 +26,7 @@ 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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase -b 4 -d 3 --keepbranches -q
hg glog --template '{rev}:{desc}:{branches}\n'
echo '% dirstate branch should be "notdefault"'
hg branch

View File

@ -13,12 +13,6 @@ o 0:c1:
% Rebase a branch while preserving the branch name
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
adding branch
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
rebase completed
@ 4:r1:notdefault
|
o 3:l2:

View File

@ -1,5 +1,7 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
@ -58,13 +60,13 @@ echo
echo '% Fix the 1st conflict'
echo 'mq1r1' > f
hg resolve -m f
hg rebase -c 2>&1 | sed -e 's/\(saving bundle to \).*/\1/'
hg rebase -c | hidebackup
echo
echo '% Fix the 2nd conflict'
echo 'mq1r1mq2' > f
hg resolve -m f
hg rebase -c 2>&1 | sed -e 's/\(saving bundle to \).*/\1/'
hg rebase -c | hidebackup
hg glog --template '{rev} {desc} tags: {tags}\n'
@ -109,7 +111,7 @@ cat .hg/patches/f.patch | filterpatch
echo
echo '% Rebase the applied mq patches'
hg rebase -s 2 -d 1 --quiet 2>&1 | sed -e 's/\(saving bundle to \).*/\1/'
hg rebase -s 2 -d 1 --quiet
echo '% And the patches are correct'
echo '% Git patch'

View File

@ -2,6 +2,8 @@
# This emulates the effects of an hg pull --rebase in which the remote repo
# already has one local mq patch
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
@ -40,5 +42,5 @@ rm p1.patch
echo
echo '% Rebase'
hg up -C qtip
hg rebase 2>&1 | sed -e 's/\(saving bundle to \).*/\1/'
hg rebase | hidebackup
hg glog --template '{rev} {desc} tags: {tags}\n'

View File

@ -21,10 +21,10 @@ merging f failed!
abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
% Fix the 1st conflict
merging f
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
adding branch

View File

@ -1,5 +1,7 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
@ -25,7 +27,7 @@ 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 2>&1 | grep -v 'saving bundle'
hg rebase -q -s 1 -d 3 | hidebackup
hg glog --template '{rev}:{desc} {node|short}\n'
exit 0

View File

@ -1,5 +1,7 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
@ -62,7 +64,7 @@ echo "% These work"
echo
echo "% Rebase with no arguments (from 3 onto 7)"
hg update -C 5
hg rebase 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase 2>&1 | hidebackup
echo "% Try to rollback after a rebase (fail)"
hg rollback
@ -71,38 +73,38 @@ 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 . 2>&1 | sed 's/\(saving bundle to \).*/\1/'
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` 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase --dest `hg branch` | hidebackup
createrepo > /dev/null 2>&1
echo
echo "% Specify only source (from 4 onto 7)"
hg rebase --source 4 2>&1 | sed 's/\(saving bundle to \).*/\1/'
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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase --dest 6 | hidebackup
createrepo > /dev/null 2>&1
echo
echo "% Specify only base (from 3 onto 7)"
hg rebase --base 5 2>&1 | sed 's/\(saving bundle to \).*/\1/'
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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase --base 4 --dest 6 | hidebackup
exit 0

View File

@ -1,5 +1,7 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
@ -34,14 +36,13 @@ addcommit "R1" 3
cd ../b
echo
echo "% Now b has one revision to be pulled from a"
hg pull --rebase 2>&1 | sed -e 's/\(saving bundle to \).*/\1/' \
-e 's/\(pulling from \).*/\1/'
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 2>&1 | sed 's/\(pulling from \).*/\1/'
hg pull --rebase | sed 's/\(pulling from \).*/\1/'
echo
echo "% Invoke pull --rebase and nothing to rebase"

View File

@ -1,5 +1,7 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
echo "[diff]" >> $HGRCPATH
@ -7,12 +9,6 @@ echo "git=1" >> $HGRCPATH
BASE=`pwd`
cleanoutput () {
sed -e 's/\(Rebase status stored to\).*/\1/' \
-e 's/\(Rebase status restored from\).*/\1/' \
-e 's/\(saving bundle to \).*/\1/'
}
hg init repo1
cd repo1
echo "a">a
@ -28,7 +24,7 @@ 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 2>&1 | cleanoutput
hg rebase -s 2 -d 1 --quiet | cleanrebase
echo
echo '% Rename is not lost'
@ -51,7 +47,7 @@ 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 2>&1 | cleanoutput
hg rebase -s 2 -d 1 --quiet | cleanrebase
echo
echo '% Copy is not lost'

View File

@ -1,5 +1,7 @@
#!/bin/sh
source $TESTDIR/helpers.sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
@ -42,32 +44,32 @@ hg glog --template '{rev}: {desc}\n'
echo '% Rebasing'
echo '% B onto F - simple rebase'
hg rebase -s 1 -d 5 2>&1 | sed 's/\(saving bundle to \).*/\1/'
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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
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 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg rebase -s 3 -d 1 | hidebackup
hg glog --template '{rev}: {desc}\n'
echo '% These will fail (using --source)'