1#!/bin/sh
2#
3# Copyright (c) 2006 Sam Vilian
4#
56
test_description='git-svn on SVK mirror paths'
7. ./lib-git-svn.sh
89
# ok, people who don't have SVK installed probably don't care about
10# this test.
1112
# 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.
1415
# we are not yet testing merge tickets..
1617
uuid=b00bface-b1ff-c0ff-f0ff-b0bafe775e1e
18url=https://really.slow.server.com/foobar
1920
test_expect_success 'initialize repo' "
21git config svn-remote.svn.useSvmProps true &&
2223
echo '#!/bin/sh' > $rawsvnrepo/hooks/pre-revprop-change &&
24echo 'exit 0' >> $rawsvnrepo/hooks/pre-revprop-change &&
25chmod +x $rawsvnrepo/hooks/pre-revprop-change &&
2627
mkdir import &&
28cd import &&
29mkdir local &&
30echo hello > local/readme &&
31svn import -m 'random local work' . $svnrepo &&
32cd .. &&
3334
svn co $svnrepo wc &&
35cd wc &&
36mkdir -p mirror/foobar &&
37svn add mirror &&
38svn ps svm:source $url mirror/foobar &&
39svn ps svm:uuid $uuid mirror/foobar &&
40svn ps svm:mirror / mirror/foobar &&
41svn commit -m 'setup mirror/foobar as mirror of upstream' &&
42svn ps -r 2 --revprop svm:headrev $uuid:0 $svnrepo &&
4344
mkdir mirror/foobar/trunk
45echo hello, world > mirror/foobar/trunk/readme &&
46svn add mirror/foobar/trunk &&
47svn commit -m 'first upstream revision' &&
48svn ps -r 3 --revprop svm:headrev $uuid:1 $svnrepo &&
4950
svn up &&
51svn mkdir mirror/foobar/branches &&
52svn cp mirror/foobar/trunk mirror/foobar/branches/silly &&
53svn commit -m 'make branch for silliness' &&
54svn ps -r 4 --revprop svm:headrev $uuid:2 $svnrepo &&
5556
svn up &&
57echo random untested feature >> mirror/foobar/trunk/readme &&
58svn commit -m 'add a c00l feature to trunk' &&
59svn ps -r 5 --revprop svm:headrev $uuid:3 $svnrepo &&
6061
svn up &&
62echo bug fix >> mirror/foobar/branches/silly/readme &&
63svn commit -m 'fix a bug' &&
64svn ps -r 6 --revprop svm:headrev $uuid:4 $svnrepo &&
6566
svn mkdir mirror/foobar/tags &&
67svn cp mirror/foobar/branches/silly mirror/foobar/tags/blah-1.0 &&
68svn commit -m 'make a release' &&
69svn ps -r 7 --revprop svm:headrev $uuid:5 $svnrepo &&
7071
cd ..
72"
7374
test_expect_success 'multi-init an SVK mirror path' "
75git-svn multi-init -T trunk -t tags -b branches $svnrepo/mirror/foobar
76"
7778
test_expect_success 'multi-fetch an SVK mirror path' "git-svn multi-fetch"
7980
test_expect_success 'got tag history OK' "
81test \`git-log --pretty=oneline remotes/tags/blah-1.0 | wc -l\` -eq 3
82"
8384
test_expect_success 're-wrote git-svn-id URL, revision and UUID' "
85git cat-file commit refs/remotes/trunk | \
86fgrep 'git-svn-id: $url/mirror/foobar/trunk@3 $uuid' &&
87git cat-file commit refs/remotes/tags/blah-1.0 | \
88fgrep 'git-svn-id: $url/mirror/foobar/tags/blah-1.0@5 $uuid'
89git cat-file commit refs/remotes/silly | \
90fgrep 'git-svn-id: $url/mirror/foobar/branches/silly@4 $uuid'
91"
9293
test_expect_success 're-wrote author e-mail domain UUID' "
94test \`git log --pretty=fuller trunk | \
95grep '<.*@.*>' | fgrep '@$uuid>' | wc -l\` -eq 4 &&
96test \`git log --pretty=fuller remotes/silly | \
97grep '<.*@.*>' | fgrep '@$uuid>' | wc -l\` -eq 6 &&
98test \`git log --pretty=fuller remotes/tags/blah-1.0 | \
99grep '<.*@.*>' | fgrep '@$uuid>' | wc -l\` -eq 6
100"
101102
test_debug 'gitk --all &'
103104
test_done