Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t9116-git-svn-log.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t9116-git-svn-log.sh` 150 lines ยท 4884 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2007 Eric Wong 4 # 5 6 test_description='git svn log tests' 7 8 . ./lib-git-svn.sh 9 10 test_expect_success 'setup repository and import' ' 11 mkdir import && 12 ( 13 cd import && 14 for i in trunk branches/a branches/b tags/0.1 tags/0.2 tags/0.3 15 do 16 mkdir -p $i && 17 echo hello >>$i/README || 18 exit 1 19 done && 20 svn_cmd import -m test . "$svnrepo" 21 ) && 22 git svn init "$svnrepo" -T trunk -b branches -t tags && 23 git svn fetch && 24 git reset --hard origin/trunk && 25 echo bye >> README && 26 git commit -a -m bye && 27 git svn dcommit && 28 git reset --hard origin/a && 29 echo why >> FEEDME && 30 git update-index --add FEEDME && 31 git commit -m feedme && 32 git svn dcommit && 33 git reset --hard origin/trunk && 34 echo aye >> README && 35 git commit -a -m aye && 36 git svn dcommit && 37 git reset --hard origin/b && 38 echo spy >> README && 39 git commit -a -m spy && 40 echo try >> README && 41 git commit -a -m try && 42 git svn dcommit 43 ' 44 45 test_expect_success 'run log' " 46 git reset --hard origin/a && 47 git svn log -r2 origin/trunk >out && 48 test_grep ^r2 out && 49 git svn log -r4 origin/trunk >out && 50 test_grep ^r4 out && 51 git svn log -r3 >out && 52 test_grep ^r3 out 53 " 54 55 test_expect_success 'run log against a from trunk' " 56 git reset --hard origin/trunk && 57 git svn log -r3 origin/a >out && 58 test_grep ^r3 out 59 " 60 61 printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4 62 63 test_expect_success 'test ascending revision range' " 64 git reset --hard origin/trunk && 65 git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 - 66 " 67 68 test_expect_success 'test ascending revision range with --show-commit' " 69 git reset --hard origin/trunk && 70 git svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 - 71 " 72 73 test_expect_success 'test ascending revision range with --show-commit (sha1)' " 74 git svn find-rev r1 >expected-range-r1-r2-r4-sha1 && 75 git svn find-rev r2 >>expected-range-r1-r2-r4-sha1 && 76 git svn find-rev r4 >>expected-range-r1-r2-r4-sha1 && 77 git reset --hard origin/trunk && 78 git svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f2 >out && 79 git rev-parse \$(cat out) >actual && 80 test_cmp expected-range-r1-r2-r4-sha1 actual 81 " 82 83 printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1 84 85 test_expect_success 'test descending revision range' " 86 git reset --hard origin/trunk && 87 git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 - 88 " 89 90 printf 'r1 \nr2 \n' > expected-range-r1-r2 91 92 test_expect_success 'test ascending revision range with unreachable revision' " 93 git reset --hard origin/trunk && 94 git svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 - 95 " 96 97 printf 'r2 \nr1 \n' > expected-range-r2-r1 98 99 test_expect_success 'test descending revision range with unreachable revision' " 100 git reset --hard origin/trunk && 101 git svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 - 102 " 103 104 printf 'r2 \n' > expected-range-r2 105 106 test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' " 107 git reset --hard origin/trunk && 108 git svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 - 109 " 110 111 test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' " 112 git reset --hard origin/trunk && 113 git svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 - 114 " 115 116 printf 'r4 \n' > expected-range-r4 117 118 test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' " 119 git reset --hard origin/trunk && 120 git svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 - 121 " 122 123 test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' " 124 git reset --hard origin/trunk && 125 git svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 - 126 " 127 128 printf -- '------------------------------------------------------------------------\n' > expected-separator 129 130 test_expect_success 'test ascending revision range with unreachable boundary revisions and no commits' " 131 git reset --hard origin/trunk && 132 git svn log -r 5:6 | test_cmp expected-separator - 133 " 134 135 test_expect_success 'test descending revision range with unreachable boundary revisions and no commits' " 136 git reset --hard origin/trunk && 137 git svn log -r 6:5 | test_cmp expected-separator - 138 " 139 140 test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' " 141 git reset --hard origin/trunk && 142 git svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 - 143 " 144 145 test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' " 146 git reset --hard origin/trunk && 147 git svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 - 148 " 149 150 test_done