Merge branch 'jc/exclusion-doc'
[alt-git.git] / t / t9020-remote-svn.sh
blob4d81ba1c2c43bfe14cb329967ccf2c97b90a4848
1 #!/bin/sh
3 test_description='tests remote-svn'
5 . ./test-lib.sh
7 MARKSPATH=.git/info/fast-import/remote-svn
9 if ! test_have_prereq PYTHON
10 then
11 skip_all='skipping remote-svn tests, python not available'
12 test_done
15 # Override svnrdump with our simulator
16 PATH="$HOME:$PATH"
17 export PATH PYTHON_PATH GIT_BUILD_DIR
19 write_script "$HOME/svnrdump" <<\EOF
20 exec "$PYTHON_PATH" "$GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py" "$@"
21 EOF
23 init_git () {
24 rm -fr .git &&
25 git init &&
26 #git remote add svnsim testsvn::sim:///$TEST_DIRECTORY/t9020/example.svnrdump
27 # let's reuse an existing dump file!?
28 git remote add svnsim testsvn::sim://$TEST_DIRECTORY/t9154/svn.dump
29 git remote add svnfile testsvn::file://$TEST_DIRECTORY/t9154/svn.dump
32 if test -e "$GIT_BUILD_DIR/git-remote-testsvn"
33 then
34 test_set_prereq REMOTE_SVN
37 test_debug '
38 git --version
39 type git
40 type svnrdump
43 test_expect_success REMOTE_SVN 'simple fetch' '
44 init_git &&
45 git fetch svnsim &&
46 test_cmp .git/refs/svn/svnsim/master .git/refs/remotes/svnsim/master &&
47 cp .git/refs/remotes/svnsim/master master.good
50 test_debug '
51 cat .git/refs/svn/svnsim/master
52 cat .git/refs/remotes/svnsim/master
55 test_expect_success REMOTE_SVN 'repeated fetch, nothing shall change' '
56 git fetch svnsim &&
57 test_cmp master.good .git/refs/remotes/svnsim/master
60 test_expect_success REMOTE_SVN 'fetch from a file:// url gives the same result' '
61 git fetch svnfile
64 test_expect_failure REMOTE_SVN 'the sha1 differ because the git-svn-id line in the commit msg contains the url' '
65 test_cmp .git/refs/remotes/svnfile/master .git/refs/remotes/svnsim/master
68 test_expect_success REMOTE_SVN 'mark-file regeneration' '
69 # filter out any other marks, that can not be regenerated. Only up to 3 digit revisions are allowed here
70 grep ":[0-9]\{1,3\} " $MARKSPATH/svnsim.marks > $MARKSPATH/svnsim.marks.old &&
71 rm $MARKSPATH/svnsim.marks &&
72 git fetch svnsim &&
73 test_cmp $MARKSPATH/svnsim.marks.old $MARKSPATH/svnsim.marks
76 test_expect_success REMOTE_SVN 'incremental imports must lead to the same head' '
77 SVNRMAX=3 &&
78 export SVNRMAX &&
79 init_git &&
80 git fetch svnsim &&
81 test_cmp .git/refs/svn/svnsim/master .git/refs/remotes/svnsim/master &&
82 unset SVNRMAX &&
83 git fetch svnsim &&
84 test_cmp master.good .git/refs/remotes/svnsim/master
87 test_debug 'git branch -a'
89 test_done