@matheusbsbs / matheus-bagliano / commits / 2edb9c5cf9
Fork 0

git-svn: make test for SVK mirror path import

A manual test that sets up a repository that looks like an SVK depot, and then imports it to check that it looks like we mirrored the 'original' source. There is also a minor modification to the git-svn test library shell file which sets a variable for the subversion repository's filesystem path. [ew: made some of the tests stricter and more thorough] Signed-off-by: Eric Wong <normalperson@yhbt.net>

sam@vilain.net committed Dec 5, 2006 at 16:17 UTC 2edb9c5cf98e1a65c775ede6fc5b10a15bb94384
2 files changed +105 -1
t/lib-git-svn.sh
+1 -1
@@ -42,9 +42,9 @@ then
42 exit
43 fi
44
45 +rawsvnrepo="$svnrepo"
46 svnrepo="file://$svnrepo"
47
47 -
48 poke() {
49 perl -e '@x = stat($ARGV[0]); utime($x[8], $x[9] + 1, $ARGV[0])' "$1"
50 }
t/t9109-git-svn-svk-mirrorpaths.sh new
+104
@@ -0,0 +1,104 @@
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 + 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 +
74 +test_expect_success 'multi-init an SVK mirror path' "
75 + git-svn multi-init -T trunk -t tags -b branches $svnrepo/mirror/foobar
76 + "
77 +
78 +test_expect_success 'multi-fetch an SVK mirror path' "git-svn multi-fetch"
79 +
80 +test_expect_success 'got tag history OK' "
81 + test \`git-log --pretty=oneline remotes/tags/blah-1.0 | wc -l\` -eq 3
82 + "
83 +
84 +test_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 +
93 +test_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 +
102 +test_debug 'gitk --all &'
103 +
104 +test_done