view tests/test-convert-hg-svn @ 10301:56b50194617f

templates: rename `Last change' column in hgwebdir repository list. This patch changes column headers in the templates that previously said `Last change' to `Last modified'. Neither code nor functionality are changed other than that. For some time now, I have been annoyed by the fact the `Last change' column didn't list the age of the youngest changeset in the repository, or at least tip. It just occurred to me that this is because the wording is slightly misleading; what the column in fact lists is when the repository was last *modified*, that is, when changesets was last added or removed from it. The word `change' can be understood as referring to the changeset itself. Using `changed' would be ever so slightly less amigous. However, the standard nomenclature in this case is `modification date' and `Last modified', which is incidentally entirely unambigous. Hence, `Last modified' is the wording used.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sun, 24 Jan 2010 20:51:53 +0100
parents a02d43acbc04
children c52057614c72
line wrap: on
line source

#!/bin/sh

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

fix_path()
{
    tr '\\' /
}

echo "[extensions]" >> $HGRCPATH
echo "convert = " >> $HGRCPATH
echo "mq = " >> $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
cd $svnpath-work
echo b > b
hg add b
hg ci -mb
echo '% adding an empty revision'
hg qnew -m emtpy empty
hg qfinish -a
cd ..

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