]> Pileus Git - ~andy/git/blob - t/t9109-git-svn-svk-mirrorpaths.sh
git-svn: allow 'init' to act as multi-init
[~andy/git] / t / t9109-git-svn-svk-mirrorpaths.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2006 Sam Vilian
4 #
5
6 test_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
17 uuid=b00bface-b1ff-c0ff-f0ff-b0bafe775e1e
18 url=https://really.slow.server.com/foobar
19
20 test_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         poke mirror/foobar/trunk/readme &&
59         svn commit -m 'add a c00l feature to trunk' &&
60         svn ps -r 5 --revprop svm:headrev $uuid:3 $svnrepo &&
61
62         svn up &&
63         echo bug fix >> mirror/foobar/branches/silly/readme &&
64         poke mirror/foobar/branches/silly/readme &&
65         svn commit -m 'fix a bug' &&
66         svn ps -r 6 --revprop svm:headrev $uuid:4 $svnrepo &&
67
68         svn mkdir mirror/foobar/tags &&
69         svn cp mirror/foobar/branches/silly mirror/foobar/tags/blah-1.0 &&
70         svn commit -m 'make a release' &&
71         svn ps -r 7 --revprop svm:headrev $uuid:5 $svnrepo &&
72
73         cd ..
74         "
75
76 test_expect_success 'init an SVK mirror path' "
77         git-svn init -T trunk -t tags -b branches $svnrepo/mirror/foobar
78         "
79
80 test_expect_success 'multi-fetch an SVK mirror path' "git-svn multi-fetch"
81
82 test_expect_success 'got tag history OK' "
83         test \`git-log --pretty=oneline remotes/tags/blah-1.0 | wc -l\` -eq 3
84         "
85
86 test_expect_success 're-wrote git-svn-id URL, revision and UUID' "
87         git cat-file commit refs/remotes/trunk | \
88             fgrep 'git-svn-id: $url/mirror/foobar/trunk@3 $uuid' &&
89         git cat-file commit refs/remotes/tags/blah-1.0 | \
90             fgrep 'git-svn-id: $url/mirror/foobar/tags/blah-1.0@5 $uuid'
91         git cat-file commit refs/remotes/silly | \
92             fgrep 'git-svn-id: $url/mirror/foobar/branches/silly@4 $uuid'
93         "
94
95 test_expect_success 're-wrote author e-mail domain UUID' "
96         test \`git log --pretty=fuller trunk | \
97                grep '<.*@.*>' | fgrep '@$uuid>' | wc -l\` -eq 4 &&
98         test \`git log --pretty=fuller remotes/silly | \
99                grep '<.*@.*>' | fgrep '@$uuid>' | wc -l\` -eq 6 &&
100         test \`git log --pretty=fuller remotes/tags/blah-1.0 | \
101                grep '<.*@.*>' | fgrep '@$uuid>' | wc -l\` -eq 6
102         "
103
104 test_debug 'gitk --all &'
105
106 test_done