tests/test-rebase-rename
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 21 Feb 2010 22:16:35 +0100
branchstable
changeset 10521 bde1bb250fc2
parent 7954 b969611064ae
child 11198 b345b1cc124f
permissions -rwxr-xr-x
Do not use osutil.c with python 2.4 and Windows (issue1364) Windows python 2.4 os.stat() reports times including DST offset, while osutil.c reports the correct value, which makes status() systematically compare files content. This bug is fixed in python 2.5. Using osutil.py instead of osutil.c is 4x times slower on large repositories but current code is completely unusable. Given few people are likely to use python 2.4 on Windows this solution was considered a good trade-off compared to more invasive solutions trying to address the offset issue.

#!/bin/sh

echo "[extensions]" >> $HGRCPATH
echo "rebase=" >> $HGRCPATH
echo "[diff]" >> $HGRCPATH
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
hg commit -Am "A" --date '0 0'
echo "b"> b
hg commit -Am "B" --date '1 0'
hg up -C 0
hg mv a a-renamed
hg commit -m 'rename A' --date '2 0'

echo
echo '% Rename is tracked'
hg log -p -r tip --template '{rev}:{desc}\n'

echo '% Rebase the revision containing the rename'
hg rebase -s 2 -d 1 --quiet 2>&1 | cleanoutput

echo
echo '% Rename is not lost'
hg log -p -r tip --template '{rev}:{desc}\n'

cd $BASE
rm -rf repo1
hg init repo1
cd repo1
echo "a">a
hg commit -Am "A" --date '0 0'
echo "b"> b
hg commit -Am "B" --date '1 0'
hg up -C 0
hg cp a a-copied
hg commit -m 'copy A' --date '2 0'

echo
echo '% Copy is tracked'
hg log -p -r tip --template '{rev}:{desc}\n'

echo '% Rebase the revision containing the copy'
hg rebase -s 2 -d 1 --quiet 2>&1 | cleanoutput

echo
echo '% Copy is not lost'
hg log -p -r tip --template '{rev}:{desc}\n'