Re: [PATCH v7 16/16] Add a test script for remote-svn
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 28, 2012, 18:01 UTC
- Message-ID
- <7vk3wi28tn.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1346143790-23491-17-git-send-email-florian.achleitner.2.6.31@gmail.com>
Florian Achleitner <florian.achleitner.2.6.31@gmail.com> writes:
Show 85 quoted lines
> Use svnrdump_sim.py to emulate svnrdump without an svn server.
> Tests fetching, incremental fetching, fetching from file://,
> and the regeneration of fast-import's marks file.
>
> Signed-off-by: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> t/t9020-remote-svn.sh | 82 +++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 82 insertions(+)
> create mode 100755 t/t9020-remote-svn.sh
>
> diff --git a/t/t9020-remote-svn.sh b/t/t9020-remote-svn.sh
> new file mode 100755
> index 0000000..e6ed4ca
> --- /dev/null
> +++ b/t/t9020-remote-svn.sh
> @@ -0,0 +1,82 @@
> +#!/bin/sh
> +
> +test_description='tests remote-svn'
> +
> +. ./test-lib.sh
> +
> +if ! test_have_prereq PYTHON
> +then
> + skip_all='skipping remote-svn tests, python not available'
> + test_done
> +fi
> +
> +# We override svnrdump by placing a symlink to the svnrdump-emulator in .
> +export PATH="$HOME:$PATH"
> +ln -sf $GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py "$HOME/svnrdump"
> +
> +init_git () {
> + rm -fr .git &&
> + git init &&
> + #git remote add svnsim testsvn::sim:///$TEST_DIRECTORY/t9020/example.svnrdump
> + # let's reuse an exisiting dump file!?
> + git remote add svnsim testsvn::sim://$TEST_DIRECTORY/t9154/svn.dump
> + git remote add svnfile testsvn::file://$TEST_DIRECTORY/t9154/svn.dump
> +}
> +
> +if test -e "$GIT_BUILD_DIR/git-remote-testsvn"
> +then
> + test_set_prereq REMOTE_SVN
> +fi
> +
> +test_debug '
> + git --version
> + which git
> + which svnrdump
> +'
> +
> +test_expect_success REMOTE_SVN 'simple fetch' '
> + init_git &&
> + git fetch svnsim &&
> + test_cmp .git/refs/svn/svnsim/master .git/refs/remotes/svnsim/master &&
> + cp .git/refs/remotes/svnsim/master master.good
> +'
> +
> +test_debug '
> + cat .git/refs/svn/svnsim/master
> + cat .git/refs/remotes/svnsim/master
> +'
> +
> +test_expect_success REMOTE_SVN 'repeated fetch, nothing shall change' '
> + git fetch svnsim &&
> + test_cmp master.good .git/refs/remotes/svnsim/master
> +'
> +
> +test_expect_success REMOTE_SVN 'fetch from a file:// url gives the same result' '
> + git fetch svnfile
> +'
> +
> +test_expect_failure REMOTE_SVN 'the sha1 differ because the git-svn-id line in the commit msg contains the url' '
> + test_cmp .git/refs/remotes/svnfile/master .git/refs/remotes/svnsim/master
> +'
> +
> +test_expect_success REMOTE_SVN 'mark-file regeneration' '
> + # filter out any other marks, that can not be regenerated. Only up to 3 digit revisions are allowed here
> + grep ":[0-9]\{1,3\} " .git/info/fast-import/remote-svn/svnsim.marks > .git/info/fast-import/remote-svn/svnsim.marks.old &&
> + rm .git/info/fast-import/remote-svn/svnsim.marks &&
> + git fetch svnsim &&
> + test_cmp .git/info/fast-import/remote-svn/svnsim.marks.old .git/info/fast-import/remote-svn/svnsim.marks
> +'Could these loooooong lines be made a bit more manageable? It is getting extremely hard to follow.
Show 13 quoted lines
> +test_expect_success REMOTE_SVN 'incremental imports must lead to the same head' ' > + export SVNRMAX=3 && > + init_git && > + git fetch svnsim && > + test_cmp .git/refs/svn/svnsim/master .git/refs/remotes/svnsim/master && > + unset SVNRMAX && > + git fetch svnsim && > + test_cmp master.good .git/refs/remotes/svnsim/master > +' > + > +test_debug 'git branch -a' > + > +test_done