tests/test-repair-strip
author Christian Ebert <blacktrash@gmx.net>
Wed, 01 Dec 2010 10:51:49 +0100
branchstable
changeset 13069 6aff4f144ad3
parent 11197 4bb4895e1693
permissions -rwxr-xr-x
keyword: copy: when copied source is a symlink, follow it 1) hg cp symlink copy -> copy is a symlink. 2) cp symlink copy; hg cp -A symlink copy -> copy is a regular file. In the second case we have to follow the symlink to its target to find out whether we have to unexpand keywords in the copy. Add test covering the case where the copied link's target is ignored by keyword but has content which would match the regex for expanded keywords to check whether we indeed leave the destination alone.

#!/bin/sh

echo "[extensions]" >> $HGRCPATH
echo "mq=">> $HGRCPATH

teststrip() {
    hg -q up -C $1
    echo % before update $1, strip $2
    hg parents
    chmod -$3 $4
    hg strip $2 2>&1 | sed 's/\(bundle\).*/\1/' | sed 's/Permission denied.*\.hg\/store\/\(.*\)/Permission denied \.hg\/store\/\1/'
    echo % after update $1, strip $2
    chmod +$3 $4
    hg verify
    echo % journal contents
    if [ -f .hg/store/journal ]; then
        sed -e 's/\.i[^\n]*/\.i/' .hg/store/journal
    else
        echo "(no journal)"
    fi
    ls .hg/store/journal >/dev/null 2>&1 && hg recover
    ls .hg/strip-backup/* >/dev/null 2>&1 && hg unbundle -q .hg/strip-backup/*
    rm -rf .hg/strip-backup
}

hg init test
cd test

echo a > a
hg -q ci -m "a" -A

echo b > b
hg -q ci -m "b" -A

echo b2 >> b
hg -q ci -m "b2" -A

echo c > c
hg -q ci -m "c" -A
 
teststrip 0 2 w .hg/store/data/b.i
teststrip 0 2 r .hg/store/data/b.i
teststrip 0 2 w .hg/store/00manifest.i