view tests/test-rebase-collapse @ 8810:ac92775b3b80

Add patch.eol to ignore EOLs when patching (issue1019) The intent is to fix many issues involving patching when win32ext is enabled. With win32ext, the working directory and repository files EOLs are not the same which means that patches made on a non-win32ext host do not apply cleanly because of EOLs discrepancies. A theorically correct approach would be transform either the patched file or the patch content with the encoding/decoding filters used by win32ext. This solution is tricky to implement and invasive, instead we prefer to address the win32ext case, by offering a way to ignore input EOLs when patching and rewriting them when saving the patched result.
author Patrick Mezard <pmezard@gmail.com>
date Mon, 15 Jun 2009 00:03:26 +0200
parents 8766fee6f225
children 49efeed49c94
line wrap: on
line source

#!/bin/sh

echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH

BASE=`pwd`

addcommit () {
    echo $1 > $1
    hg add $1
    hg commit -d "${2} 0" -m $1
}

commit () {
    hg commit -d "${2} 0" -m $1
}

createrepo () {
    cd $BASE
    rm -rf a
    hg init a
    cd a
    addcommit "A" 0
    addcommit "B" 1
    addcommit "C" 2
    addcommit "D" 3

    hg update -C 0
    addcommit "E" 4

    hg update -C 0
    addcommit "F" 5

    hg merge -r 4
    commit "G" 6

    hg update -C 5
    addcommit "H" 7
}

createrepo > /dev/null 2>&1
hg glog  --template '{rev}: {desc}\n'
echo '% Rebasing B onto H'
hg up -C 3
hg rebase --collapse 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
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
    rm -rf a
    hg init a
    cd a
    addcommit "A" 0
    addcommit "B" 1

    hg up 0
    addcommit "C" 2
    hg merge
    commit "D" 3

    hg up 1
    addcommit "E" 4

    addcommit "F" 5

    hg merge
    commit "G" 6

    hg up 0
    addcommit "H" 7
}

echo
createrepocomplex > /dev/null 2>&1
hg glog  --template '{rev}: {desc}\n'

echo
echo '% Rebase and collapse - more than one external (fail)'
hg rebase -s 2 --collapse

echo
echo '% Rebase and collapse - E onto H'
hg rebase -s 4 --collapse 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