Git fork
at reftables-rust 122 lines 4.1 kB view raw
1#!/bin/sh 2# 3# Copyright (c) 2009 Marc Branchaud 4# 5 6test_description='git svn multiple branch and tag paths in the svn repo' 7. ./lib-git-svn.sh 8 9test_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 && 17 svn_cmd import -m "$test_description" project "$svnrepo/project" && 18 rm -rf project && 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 && 25 echo 2 > trunk/a.file && 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" && 31 echo 3 > trunk/a.file && 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" && 37 echo 4 > trunk/a.file && 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 && 44 echo 5 > b_one/first/a.file && 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" && 48 echo 6 > b_one/second/a.file && 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" && 52 echo 7 > b_two/1/a.file && 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" && 56 echo 8 > b_two/2/a.file && 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' 62 63test_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 && 68 ( cd git_project && 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 81 ) 82' 83 84test_expect_success 'Multiple branch or tag paths require -d' ' 85 ( cd git_project && 86 test_must_fail git svn branch -m "No new branch" Nope && 87 test_must_fail git svn tag -m "No new tag" Tagless && 88 test_must_fail git rev-parse refs/remotes/origin/Nope && 89 test_must_fail git rev-parse refs/remotes/origin/tags/Tagless 90 ) && 91 ( cd svn_project && 92 svn_cmd up && 93 test_path_is_missing b_one/Nope && 94 test_path_is_missing b_two/Nope && 95 test_path_is_missing tags_A/Tagless && 96 test_path_is_missing tags_B/Tagless 97 ) 98' 99 100test_expect_success 'create new branches and tags' ' 101 ( cd git_project && 102 git svn branch -m "New branch 1" -d b_one New1 ) && 103 ( cd svn_project && 104 svn_cmd up && test -e b_one/New1/a.file ) && 105 106 ( cd git_project && 107 git svn branch -m "New branch 2" -d b_two New2 ) && 108 ( cd svn_project && 109 svn_cmd up && test -e b_two/New2/a.file ) && 110 111 ( cd git_project && 112 git svn branch -t -m "New tag 1" -d tags_A Tag1 ) && 113 ( cd svn_project && 114 svn_cmd up && test -e tags_A/Tag1/a.file ) && 115 116 ( cd git_project && 117 git svn tag -m "New tag 2" -d tags_B Tag2 ) && 118 ( cd svn_project && 119 svn_cmd up && test -e tags_B/Tag2/a.file ) 120' 121 122test_done