t / t9109-git-svn-svk-mirrorpaths.shon commit git-svn: make test for SVK mirror path import (2edb9c5)
   1#!/bin/sh
   2#
   3# Copyright (c) 2006 Sam Vilian
   4#
   5
   6test_description='git-svn on SVK mirror paths'
   7. ./lib-git-svn.sh
   8
   9# ok, people who don't have SVK installed probably don't care about
  10# this test.
  11
  12# we set up the repository manually, because even if SVK is installed
  13# it is difficult to use it in a way that is idempotent.
  14
  15# we are not yet testing merge tickets..
  16
  17uuid=b00bface-b1ff-c0ff-f0ff-b0bafe775e1e
  18url=https://really.slow.server.com/foobar
  19
  20test_expect_success 'initialize repo' "
  21        git config svn-remote.svn.useSvmProps true &&
  22
  23        echo '#!/bin/sh' > $rawsvnrepo/hooks/pre-revprop-change &&
  24        echo 'exit 0' >> $rawsvnrepo/hooks/pre-revprop-change &&
  25        chmod +x $rawsvnrepo/hooks/pre-revprop-change &&
  26
  27        mkdir import &&
  28        cd import &&
  29        mkdir local &&
  30        echo hello > local/readme &&
  31        svn import -m 'random local work' . $svnrepo &&
  32        cd .. &&
  33
  34        svn co $svnrepo wc &&
  35        cd wc &&
  36        mkdir -p mirror/foobar &&
  37        svn add mirror &&
  38        svn ps svm:source $url mirror/foobar &&
  39        svn ps svm:uuid $uuid mirror/foobar &&
  40        svn ps svm:mirror / mirror/foobar &&
  41        svn commit -m 'setup mirror/foobar as mirror of upstream' &&
  42        svn ps -r 2 --revprop svm:headrev $uuid:0 $svnrepo &&
  43
  44        mkdir mirror/foobar/trunk
  45        echo hello, world > mirror/foobar/trunk/readme &&
  46        svn add mirror/foobar/trunk &&
  47        svn commit -m 'first upstream revision' &&
  48        svn ps -r 3 --revprop svm:headrev $uuid:1 $svnrepo &&
  49
  50        svn up &&
  51        svn mkdir mirror/foobar/branches &&
  52        svn cp mirror/foobar/trunk mirror/foobar/branches/silly &&
  53        svn commit -m 'make branch for silliness' &&
  54        svn ps -r 4 --revprop svm:headrev $uuid:2 $svnrepo &&
  55
  56        svn up &&
  57        echo random untested feature >> mirror/foobar/trunk/readme &&
  58        svn commit -m 'add a c00l feature to trunk' &&
  59        svn ps -r 5 --revprop svm:headrev $uuid:3 $svnrepo &&
  60
  61        svn up &&
  62        echo bug fix >> mirror/foobar/branches/silly/readme &&
  63        svn commit -m 'fix a bug' &&
  64        svn ps -r 6 --revprop svm:headrev $uuid:4 $svnrepo &&
  65
  66        svn mkdir mirror/foobar/tags &&
  67        svn cp mirror/foobar/branches/silly mirror/foobar/tags/blah-1.0 &&
  68        svn commit -m 'make a release' &&
  69        svn ps -r 7 --revprop svm:headrev $uuid:5 $svnrepo &&
  70
  71        cd ..
  72        "
  73
  74test_expect_success 'multi-init an SVK mirror path' "
  75        git-svn multi-init -T trunk -t tags -b branches $svnrepo/mirror/foobar
  76        "
  77
  78test_expect_success 'multi-fetch an SVK mirror path' "git-svn multi-fetch"
  79
  80test_expect_success 'got tag history OK' "
  81        test \`git-log --pretty=oneline remotes/tags/blah-1.0 | wc -l\` -eq 3
  82        "
  83
  84test_expect_success 're-wrote git-svn-id URL, revision and UUID' "
  85        git cat-file commit refs/remotes/trunk | \
  86            fgrep 'git-svn-id: $url/mirror/foobar/trunk@3 $uuid' &&
  87        git cat-file commit refs/remotes/tags/blah-1.0 | \
  88            fgrep 'git-svn-id: $url/mirror/foobar/tags/blah-1.0@5 $uuid'
  89        git cat-file commit refs/remotes/silly | \
  90            fgrep 'git-svn-id: $url/mirror/foobar/branches/silly@4 $uuid'
  91        "
  92
  93test_expect_success 're-wrote author e-mail domain UUID' "
  94        test \`git log --pretty=fuller trunk | \
  95               grep '<.*@.*>' | fgrep '@$uuid>' | wc -l\` -eq 4 &&
  96        test \`git log --pretty=fuller remotes/silly | \
  97               grep '<.*@.*>' | fgrep '@$uuid>' | wc -l\` -eq 6 &&
  98        test \`git log --pretty=fuller remotes/tags/blah-1.0 | \
  99               grep '<.*@.*>' | fgrep '@$uuid>' | wc -l\` -eq 6
 100        "
 101
 102test_debug 'gitk --all &'
 103
 104test_done