3 # Copyright (c) 2007 Eric Wong
6 test_description='git-svn log tests'
9 test_expect_success 'setup repository and import' "
12 for i in trunk branches/a branches/b \
13 tags/0.1 tags/0.2 tags/0.3; do
15 echo hello >> \$i/README || exit 1
17 svn import -m test . $svnrepo
19 git-svn init $svnrepo -T trunk -b branches -t tags &&
21 git reset --hard trunk &&
23 git commit -a -m bye &&
27 git update-index --add FEEDME &&
28 git commit -m feedme &&
30 git reset --hard trunk &&
32 git commit -a -m aye &&
36 git commit -a -m spy &&
38 git commit -a -m try &&
42 test_expect_success 'run log' "
44 git svn log -r2 trunk | grep ^r2 &&
45 git svn log -r4 trunk | grep ^r4 &&
46 git svn log -r3 | grep ^r3
49 test_expect_success 'run log against a from trunk' "
50 git reset --hard trunk &&
51 git svn log -r3 a | grep ^r3
54 printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4
56 test_expect_success 'test ascending revision range' "
57 git reset --hard trunk &&
58 git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
61 printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1
63 test_expect_success 'test descending revision range' "
64 git reset --hard trunk &&
65 git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -
68 printf 'r1 \nr2 \n' > expected-range-r1-r2
70 test_expect_success 'test ascending revision range with unreachable revision' "
71 git reset --hard trunk &&
72 git svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -
75 printf 'r2 \nr1 \n' > expected-range-r2-r1
77 test_expect_success 'test descending revision range with unreachable revision' "
78 git reset --hard trunk &&
79 git svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -
82 printf 'r2 \n' > expected-range-r2
84 test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' "
85 git reset --hard trunk &&
86 git svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -
89 test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' "
90 git reset --hard trunk &&
91 git svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -
94 printf 'r4 \n' > expected-range-r4
96 test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' "
97 git reset --hard trunk &&
98 git svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
101 test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' "
102 git reset --hard trunk &&
103 git svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
106 printf -- '------------------------------------------------------------------------\n' > expected-separator
108 test_expect_success 'test ascending revision range with unreachable boundary revisions and no commits' "
109 git reset --hard trunk &&
110 git svn log -r 5:6 | test_cmp expected-separator -
113 test_expect_success 'test descending revision range with unreachable boundary revisions and no commits' "
114 git reset --hard trunk &&
115 git svn log -r 6:5 | test_cmp expected-separator -
118 test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' "
119 git reset --hard trunk &&
120 git svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
123 test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' "
124 git reset --hard trunk &&
125 git svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -