view tests/test-convert-hg-svn @ 9021:2ccb527c7b1a

gendoc: fix localization of help topic When a topic provides a callable method for its text, most likely this text will be generated from different parts, so it does not make sense to apply gettext on the whole result, rather the method should provide translation by itself. This is the case with the extensions topic, which triggers a double gettext call, making the ASCII codec fail when it encounters 8 bit characters, and prevents the documentation from being built.
author Cédric Duval <cedricduval@free.fr>
date Sat, 04 Jul 2009 12:12:36 +0200
parents 34c4131abdf9
children a02d43acbc04
line wrap: on
line source

#!/bin/sh

"$TESTDIR/hghave" svn svn-bindings || exit 80

fix_path()
{
    tr '\\' /
}

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

svnpath=`pwd | fix_path`/svn-repo
svnadmin create $svnpath

cat > $svnpath/hooks/pre-revprop-change <<'EOF'
#!/bin/sh

REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"

if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi
if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi

echo "Changing prohibited revision property" >&2
exit 1
EOF
chmod +x $svnpath/hooks/pre-revprop-change

# SVN wants all paths to start with a slash. Unfortunately,
# Windows ones don't. Handle that.
svnurl=$svnpath
expr $svnurl : "\/" > /dev/null
if [ $? -ne 0 ]; then
    svnurl='/'$svnurl
fi
svnurl=file://$svnurl
svn co $svnurl $svnpath-wc

cd $svnpath-wc
echo a > a
svn add a
svn ci -m'added a' a

cd ..

echo % initial roundtrip
hg convert -s svn -d hg $svnpath-wc $svnpath-hg | grep -v initializing
hg convert -s hg -d svn $svnpath-hg $svnpath-wc

echo % second roundtrip should do nothing
hg convert -s svn -d hg $svnpath-wc $svnpath-hg
hg convert -s hg -d svn $svnpath-hg $svnpath-wc

echo % new hg rev

hg clone $svnpath-hg $svnpath-work
echo b > $svnpath-work/b
hg --cwd $svnpath-work add b
hg --cwd $svnpath-work ci -mb

echo % echo hg to svn
hg --cwd $svnpath-hg pull -q $svnpath-work
hg convert -s hg -d svn $svnpath-hg $svnpath-wc

echo % svn back to hg should do nothing
hg convert -s svn -d hg $svnpath-wc $svnpath-hg
echo % hg back to svn should do nothing
hg convert -s hg -d svn $svnpath-hg $svnpath-wc