3 # Copyright (c) 2007 Eric Wong
6 test_description
='git svn log tests'
9 test_expect_success
'setup repository and import' '
13 for i in trunk branches/a branches/b tags/0.1 tags/0.2 tags/0.3
16 echo hello >>$i/README ||
19 svn_cmd import -m test . "$svnrepo"
21 git svn init "$svnrepo" -T trunk -b branches -t tags &&
23 git reset --hard trunk &&
25 git commit -a -m bye &&
29 git update-index --add FEEDME &&
30 git commit -m feedme &&
32 git reset --hard trunk &&
34 git commit -a -m aye &&
38 git commit -a -m spy &&
40 git commit -a -m try &&
44 test_expect_success
'run log' "
46 git svn log -r2 trunk | grep ^r2 &&
47 git svn log -r4 trunk | grep ^r4 &&
48 git svn log -r3 | grep ^r3
51 test_expect_success
'run log against a from trunk' "
52 git reset --hard trunk &&
53 git svn log -r3 a | grep ^r3
56 printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4
58 test_expect_success
'test ascending revision range' "
59 git reset --hard trunk &&
60 git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
63 printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1
65 test_expect_success
'test descending revision range' "
66 git reset --hard trunk &&
67 git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -
70 printf 'r1 \nr2 \n' > expected-range-r1-r2
72 test_expect_success
'test ascending revision range with unreachable revision' "
73 git reset --hard trunk &&
74 git svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -
77 printf 'r2 \nr1 \n' > expected-range-r2-r1
79 test_expect_success
'test descending revision range with unreachable revision' "
80 git reset --hard trunk &&
81 git svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -
84 printf 'r2 \n' > expected-range-r2
86 test_expect_success
'test ascending revision range with unreachable upper boundary revision and 1 commit' "
87 git reset --hard trunk &&
88 git svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -
91 test_expect_success
'test descending revision range with unreachable upper boundary revision and 1 commit' "
92 git reset --hard trunk &&
93 git svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -
96 printf 'r4 \n' > expected-range-r4
98 test_expect_success
'test ascending revision range with unreachable lower boundary revision and 1 commit' "
99 git reset --hard trunk &&
100 git svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
103 test_expect_success
'test descending revision range with unreachable lower boundary revision and 1 commit' "
104 git reset --hard trunk &&
105 git svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
108 printf -- '------------------------------------------------------------------------\n' > expected-separator
110 test_expect_success
'test ascending revision range with unreachable boundary revisions and no commits' "
111 git reset --hard trunk &&
112 git svn log -r 5:6 | test_cmp expected-separator -
115 test_expect_success
'test descending revision range with unreachable boundary revisions and no commits' "
116 git reset --hard trunk &&
117 git svn log -r 6:5 | test_cmp expected-separator -
120 test_expect_success
'test ascending revision range with unreachable boundary revisions and 1 commit' "
121 git reset --hard trunk &&
122 git svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
125 test_expect_success
'test descending revision range with unreachable boundary revisions and 1 commit' "
126 git reset --hard trunk &&
127 git svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -