t / t9020-remote-svn.shon commit Merge branch 'mg/more-textconv' (4197361)
   1#!/bin/sh
   2
   3test_description='tests remote-svn'
   4
   5. ./test-lib.sh
   6
   7MARKSPATH=.git/info/fast-import/remote-svn
   8
   9if ! test_have_prereq PYTHON
  10then
  11        skip_all='skipping remote-svn tests, python not available'
  12        test_done
  13fi
  14
  15# Override svnrdump with our simulator
  16PATH="$HOME:$PATH"
  17export PATH PYTHON_PATH GIT_BUILD_DIR
  18
  19write_script "$HOME/svnrdump" <<\EOF
  20exec "$PYTHON_PATH" "$GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py" "$@"
  21EOF
  22
  23init_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
  30}
  31
  32if test -e "$GIT_BUILD_DIR/git-remote-testsvn"
  33then
  34        test_set_prereq REMOTE_SVN
  35fi
  36
  37test_debug '
  38        git --version
  39        type git
  40        type svnrdump
  41'
  42
  43test_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
  48'
  49
  50test_debug '
  51        cat .git/refs/svn/svnsim/master
  52        cat .git/refs/remotes/svnsim/master
  53'
  54
  55test_expect_success REMOTE_SVN 'repeated fetch, nothing shall change' '
  56        git fetch svnsim &&
  57        test_cmp master.good .git/refs/remotes/svnsim/master
  58'
  59
  60test_expect_success REMOTE_SVN 'fetch from a file:// url gives the same result' '
  61        git fetch svnfile
  62'
  63
  64test_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
  66'
  67
  68test_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
  74'
  75
  76test_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
  85'
  86
  87test_debug 'git branch -a'
  88
  89test_done