]>
Commit | Line | Data |
---|---|---|
62244069 MB |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2009 Marc Branchaud | |
4 | # | |
5 | ||
6 | test_description='git svn multiple branch and tag paths in the svn repo' | |
7 | . ./lib-git-svn.sh | |
8 | ||
9 | test_expect_success 'setup svnrepo' ' | |
10 | mkdir project \ | |
11 | project/trunk \ | |
12 | project/b_one \ | |
13 | project/b_two \ | |
14 | project/tags_A \ | |
15 | project/tags_B && | |
16 | echo 1 > project/trunk/a.file && | |
b5c9b38b | 17 | svn_cmd import -m "$test_description" project "$svnrepo/project" && |
62244069 | 18 | rm -rf project && |
b5c9b38b MB |
19 | svn_cmd cp -m "Branch 1" "$svnrepo/project/trunk" \ |
20 | "$svnrepo/project/b_one/first" && | |
21 | svn_cmd cp -m "Tag 1" "$svnrepo/project/trunk" \ | |
22 | "$svnrepo/project/tags_A/1.0" && | |
23 | svn_cmd co "$svnrepo/project" svn_project && | |
24 | ( cd svn_project && | |
62244069 | 25 | echo 2 > trunk/a.file && |
b5c9b38b MB |
26 | svn_cmd ci -m "Change 1" trunk/a.file && |
27 | svn_cmd cp -m "Branch 2" "$svnrepo/project/trunk" \ | |
28 | "$svnrepo/project/b_one/second" && | |
29 | svn_cmd cp -m "Tag 2" "$svnrepo/project/trunk" \ | |
30 | "$svnrepo/project/tags_A/2.0" && | |
62244069 | 31 | echo 3 > trunk/a.file && |
b5c9b38b MB |
32 | svn_cmd ci -m "Change 2" trunk/a.file && |
33 | svn_cmd cp -m "Branch 3" "$svnrepo/project/trunk" \ | |
34 | "$svnrepo/project/b_two/1" && | |
35 | svn_cmd cp -m "Tag 3" "$svnrepo/project/trunk" \ | |
36 | "$svnrepo/project/tags_A/3.0" && | |
62244069 | 37 | echo 4 > trunk/a.file && |
b5c9b38b MB |
38 | svn_cmd ci -m "Change 3" trunk/a.file && |
39 | svn_cmd cp -m "Branch 4" "$svnrepo/project/trunk" \ | |
40 | "$svnrepo/project/b_two/2" && | |
41 | svn_cmd cp -m "Tag 4" "$svnrepo/project/trunk" \ | |
42 | "$svnrepo/project/tags_A/4.0" && | |
43 | svn_cmd up && | |
62244069 | 44 | echo 5 > b_one/first/a.file && |
b5c9b38b MB |
45 | svn_cmd ci -m "Change 4" b_one/first/a.file && |
46 | svn_cmd cp -m "Tag 5" "$svnrepo/project/b_one/first" \ | |
47 | "$svnrepo/project/tags_B/v5" && | |
62244069 | 48 | echo 6 > b_one/second/a.file && |
b5c9b38b MB |
49 | svn_cmd ci -m "Change 5" b_one/second/a.file && |
50 | svn_cmd cp -m "Tag 6" "$svnrepo/project/b_one/second" \ | |
51 | "$svnrepo/project/tags_B/v6" && | |
62244069 | 52 | echo 7 > b_two/1/a.file && |
b5c9b38b MB |
53 | svn_cmd ci -m "Change 6" b_two/1/a.file && |
54 | svn_cmd cp -m "Tag 7" "$svnrepo/project/b_two/1" \ | |
55 | "$svnrepo/project/tags_B/v7" && | |
62244069 | 56 | echo 8 > b_two/2/a.file && |
b5c9b38b MB |
57 | svn_cmd ci -m "Change 7" b_two/2/a.file && |
58 | svn_cmd cp -m "Tag 8" "$svnrepo/project/b_two/2" \ | |
59 | "$svnrepo/project/tags_B/v8" | |
60 | ) | |
61 | ' | |
62244069 MB |
62 | |
63 | test_expect_success 'clone multiple branch and tag paths' ' | |
64 | git svn clone -T trunk \ | |
65 | -b b_one/* --branches b_two/* \ | |
66 | -t tags_A/* --tags tags_B \ | |
67 | "$svnrepo/project" git_project && | |
b5c9b38b | 68 | ( cd git_project && |
fe191fca JH |
69 | git rev-parse refs/remotes/origin/first && |
70 | git rev-parse refs/remotes/origin/second && | |
71 | git rev-parse refs/remotes/origin/1 && | |
72 | git rev-parse refs/remotes/origin/2 && | |
73 | git rev-parse refs/remotes/origin/tags/1.0 && | |
74 | git rev-parse refs/remotes/origin/tags/2.0 && | |
75 | git rev-parse refs/remotes/origin/tags/3.0 && | |
76 | git rev-parse refs/remotes/origin/tags/4.0 && | |
77 | git rev-parse refs/remotes/origin/tags/v5 && | |
78 | git rev-parse refs/remotes/origin/tags/v6 && | |
79 | git rev-parse refs/remotes/origin/tags/v7 && | |
80 | git rev-parse refs/remotes/origin/tags/v8 | |
b5c9b38b MB |
81 | ) |
82 | ' | |
62244069 MB |
83 | |
84 | test_expect_success 'Multiple branch or tag paths require -d' ' | |
b5c9b38b | 85 | ( cd git_project && |
62244069 MB |
86 | test_must_fail git svn branch -m "No new branch" Nope && |
87 | test_must_fail git svn tag -m "No new tag" Tagless && | |
fe191fca JH |
88 | test_must_fail git rev-parse refs/remotes/origin/Nope && |
89 | test_must_fail git rev-parse refs/remotes/origin/tags/Tagless | |
b5c9b38b MB |
90 | ) && |
91 | ( cd svn_project && | |
92 | svn_cmd up && | |
62244069 MB |
93 | test_must_fail test -d b_one/Nope && |
94 | test_must_fail test -d b_two/Nope && | |
95 | test_must_fail test -d tags_A/Tagless && | |
b5c9b38b MB |
96 | test_must_fail test -d tags_B/Tagless |
97 | ) | |
98 | ' | |
62244069 MB |
99 | |
100 | test_expect_success 'create new branches and tags' ' | |
b5c9b38b | 101 | ( cd git_project && |
0b2af457 | 102 | git svn branch -m "New branch 1" -d b_one New1 ) && |
b5c9b38b MB |
103 | ( cd svn_project && |
104 | svn_cmd up && test -e b_one/New1/a.file ) && | |
62244069 | 105 | |
b5c9b38b | 106 | ( cd git_project && |
0b2af457 | 107 | git svn branch -m "New branch 2" -d b_two New2 ) && |
b5c9b38b MB |
108 | ( cd svn_project && |
109 | svn_cmd up && test -e b_two/New2/a.file ) && | |
62244069 | 110 | |
b5c9b38b | 111 | ( cd git_project && |
0b2af457 | 112 | git svn branch -t -m "New tag 1" -d tags_A Tag1 ) && |
b5c9b38b MB |
113 | ( cd svn_project && |
114 | svn_cmd up && test -e tags_A/Tag1/a.file ) && | |
62244069 | 115 | |
b5c9b38b | 116 | ( cd git_project && |
0b2af457 | 117 | git svn tag -m "New tag 2" -d tags_B Tag2 ) && |
b5c9b38b MB |
118 | ( cd svn_project && |
119 | svn_cmd up && test -e tags_B/Tag2/a.file ) | |
120 | ' | |
62244069 MB |
121 | |
122 | test_done |