diff tests/test-rebase-collapse @ 7278:45495d784ad6

rebase: avoid redundant merges (issue1301)
author Stefano Tortarolo <stefano.tortarolo@gmail.com>
date Tue, 16 Sep 2008 17:51:14 +0200
parents 93609576244e
children 8766fee6f225
line wrap: on
line diff
--- a/tests/test-rebase-collapse	Mon Oct 06 14:41:22 2008 +0200
+++ b/tests/test-rebase-collapse	Tue Sep 16 17:51:14 2008 +0200
@@ -41,15 +41,20 @@
 
 createrepo > /dev/null 2>&1
 hg glog  --template '{rev}: {desc}\n'
-echo '% Rebasing'
+echo '% Rebasing B onto H'
 hg up -C 3
 hg rebase --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
 hg glog  --template '{rev}: {desc}\n'
+echo "Expected A, B, C, D, F, H"
+hg manifest
 
 createrepo > /dev/null 2>&1
-echo '% Rebasing'
+echo
+echo '% Rebasing G onto H'
 hg rebase --base 6 --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
 hg glog  --template '{rev}: {desc}\n'
+echo "Expected A, E, F, H"
+hg manifest
 
 createrepocomplex () {
     cd $BASE
@@ -76,6 +81,7 @@
     addcommit "H" 7
 }
 
+echo
 createrepocomplex > /dev/null 2>&1
 hg glog  --template '{rev}: {desc}\n'
 
@@ -84,8 +90,91 @@
 hg rebase -s 2 --collapse
 
 echo
-echo '% Rebase and collapse'
+echo '% Rebase and collapse - E onto H'
 hg rebase -s 4 --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
 hg glog  --template '{rev}: {desc}\n'
+echo "Expected A, B, C, E, F, H"
+hg manifest
 
+createrepocomplex () {
+    cd $BASE
+    rm -rf a
+    hg init a
+    cd a
+    addcommit "A" 0
+    addcommit "B" 1
+
+    hg up 0
+    addcommit "C" 2
+    hg merge
+    commit "D" 3
+
+    hg up 1
+    addcommit "E" 4
+    
+    echo "F" > E
+    commit "F" 5
+
+    addcommit "G" 6
+
+    hg merge
+    commit "H" 7
+
+    hg up 0
+    addcommit "I" 8
+}
+
+echo
+createrepocomplex > /dev/null 2>&1
+hg glog  --template '{rev}: {desc}\n'
+
+echo
+echo '% Rebase and collapse - E onto I'
+hg rebase -s 4 --collapse 
+
+echo '% Fix conflict and continue'
+echo 'Resolved merge' > E
+hg resolve -m E
+hg rebase -c 2>&1 | sed 's/\(saving bundle to \).*/\1/'
+
+hg glog  --template '{rev}: {desc}\n'
+
+echo "Expected A, B, C, E, G, I"
+hg manifest
+
+echo 'Cat E:'
+cat E
+
+createrepocomplex () {
+    cd $BASE
+    rm -rf a
+    hg init a
+    cd a
+    addcommit "A" 0
+    addcommit "B" 1
+
+    addcommit "C" 2
+    hg up 1
+
+    addcommit "D" 3
+    
+    hg merge
+    commit "E" 4
+
+    hg up 0
+    addcommit "F" 5
+}
+
+echo
+createrepocomplex > /dev/null 2>&1
+hg glog  --template '{rev}: {desc}\n'
+
+echo
+echo '% Rebase and collapse - B onto F'
+hg rebase -s 1 --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
+
+hg glog  --template '{rev}: {desc}\n'
+
+echo "Expected A, B, C, D, F"
+hg manifest
 exit 0