view tests/test-subrepo-svn @ 10189:e451e599fbcf

patch: support diff data loss detection and upgrade In worst case, generating diff in upgrade mode can be two times more expensive than generating it in git mode directly: we may have to regenerate the whole diff again whenever a git feature is detected. Also, the first diff attempt is completely buffered instead of being streamed. That said, even without having profiled it yet, I am convinced we can fast-path the upgrade mode if necessary were it to be used in regular diff commands, and not only in mq where avoiding data loss is worth the price.
author Patrick Mezard <pmezard@gmail.com>
date Fri, 01 Jan 2010 20:54:05 +0100
parents cd477be6f2fc
children 20d849251fe6
line wrap: on
line source

#!/bin/sh

"$TESTDIR/hghave" svn || exit 80

escapedwd=$(pwd | \
            python -c \
            "import sys,urllib; print urllib.pathname2url(sys.stdin.read().strip())"
           )
filterpath="sed s+$escapedwd+/root+"

echo % create subversion repo

SVNREPO="file://$escapedwd/svn-repo"
WCROOT="$(pwd)/svn-wc"
svnadmin create svn-repo
svn co $SVNREPO svn-wc
cd svn-wc
echo alpha > alpha
svn add alpha
svn ci -m 'Add alpha'
cd ..

echo % create hg repo

rm -rf sub
mkdir sub
cd sub
hg init t
cd t

echo % first revision, no sub
echo a > a
hg ci -Am0

echo % add first svn sub
echo "s = [svn]$SVNREPO" >> .hgsub
svn co --quiet $SVNREPO s
hg add .hgsub
hg ci -m1
echo % debugsub
hg debugsub | $filterpath

echo
echo % change file in svn and hg, commit
echo a >> a
echo alpha >> s/alpha
hg commit -m 'Message!'
hg debugsub | $filterpath

echo
echo a > s/a
echo % should be empty despite change to s/a
hg st

echo
echo % add a commit from svn
pushd "$WCROOT" > /dev/null
svn up
echo xyz >> alpha
svn ci -m 'amend a from svn'
popd > /dev/null
echo % this commit from hg will fail
echo zzz >> s/alpha
hg ci -m 'amend alpha from hg'

echo
echo % clone
cd ..
hg clone t tc
cd tc
echo % debugsub in clone
hg debugsub | $filterpath