tests/test-convert-svn-sink
author Bryan O'Sullivan <bos@serpentine.com>
Wed, 07 Nov 2007 18:26:59 -0800
changeset 5513 f0c58fd4b798
child 5538 dc8fa3482a9a
permissions -rwxr-xr-x
convert: add support for Subversion as a sink

#!/bin/sh

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

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

hg init a

echo a > a/a
echo % add
hg --cwd a ci -d '0 0' -A -m 'add a file'

echo a >> a/a
echo % modify
hg --cwd a ci -d '1 0' -m 'modify a file'
hg --cwd a tip -q

hg convert -d svn a
(cd a-hg-wc; svn up; svn st -v; svn log --xml -v --limit=2 | sed 's,<date>.*,<date/>,')
ls a a-hg-wc
cmp a/a a-hg-wc/a && echo same || echo different

hg --cwd a mv a b
echo % rename
hg --cwd a ci -d '2 0' -m 'rename a file'
hg --cwd a tip -q

hg convert -d svn a
(cd a-hg-wc; svn up; svn st -v; svn log --xml -v --limit=1 | sed 's,<date>.*,<date/>,')
ls a a-hg-wc

hg --cwd a cp b c
echo % copy
hg --cwd a ci -d '3 0' -m 'copy a file'
hg --cwd a tip -q

hg convert -d svn a
(cd a-hg-wc; svn up; svn st -v; svn log --xml -v --limit=1 | sed 's,<date>.*,<date/>,')
ls a a-hg-wc

hg --cwd a rm b
echo % remove
hg --cwd a ci -d '4 0' -m 'remove a file'
hg --cwd a tip -q

hg convert -d svn a
(cd a-hg-wc; svn up; svn st -v; svn log --xml -v --limit=1 | sed 's,<date>.*,<date/>,')
ls a a-hg-wc

chmod +x a/c
echo % executable
hg --cwd a ci -d '5 0' -m 'make a file executable'
hg --cwd a tip -q

hg convert -d svn a
(cd a-hg-wc; svn up; svn st -v; svn log --xml -v --limit=1 | sed 's,<date>.*,<date/>,')
test -x a-hg-wc/c && echo executable || echo not executable

echo % branchy history

hg init b
echo base > b/b
hg --cwd b ci -d '0 0' -Ambase

echo left-1 >> b/b
echo left-1 > b/left-1
hg --cwd b ci -d '1 0' -Amleft-1

echo left-2 >> b/b
echo left-2 > b/left-2
hg --cwd b ci -d '2 0' -Amleft-2

hg --cwd b up 0

echo right-1 >> b/b
echo right-1 > b/right-1
hg --cwd b ci -d '3 0' -Amright-1

echo right-2 >> b/b
echo right-2 > b/right-2
hg --cwd b ci -d '4 0' -Amright-2

hg --cwd b up -C 2
hg --cwd b merge
hg --cwd b revert -r 2 b
hg --cwd b ci -d '5 0' -m 'merge'

hg convert -d svn b
echo % expect 4 changes
(cd b-hg-wc; svn up; svn st -v; svn log --xml -v | sed 's,<date>.*,<date/>,')