]> git.ipfire.org Git - thirdparty/git.git/blame - t/t9116-git-svn-log.sh
l10n: fr v2.23.0 round 2
[thirdparty/git.git] / t / t9116-git-svn-log.sh
CommitLineData
6ed77266
EW
1#!/bin/sh
2#
3# Copyright (c) 2007 Eric Wong
4#
5
1364ff27 6test_description='git svn log tests'
6ed77266
EW
7. ./lib-git-svn.sh
8
f69e836f 9test_expect_success 'setup repository and import' '
6ed77266 10 mkdir import &&
18a82692
JN
11 (
12 cd import &&
13 for i in trunk branches/a branches/b tags/0.1 tags/0.2 tags/0.3
14 do
15 mkdir -p $i &&
16 echo hello >>$i/README ||
17 exit 1
18 done &&
da083d68 19 svn_cmd import -m test . "$svnrepo"
18a82692 20 ) &&
1364ff27
NS
21 git svn init "$svnrepo" -T trunk -b branches -t tags &&
22 git svn fetch &&
fe191fca 23 git reset --hard origin/trunk &&
6ed77266
EW
24 echo bye >> README &&
25 git commit -a -m bye &&
26 git svn dcommit &&
fe191fca 27 git reset --hard origin/a &&
6ed77266
EW
28 echo why >> FEEDME &&
29 git update-index --add FEEDME &&
30 git commit -m feedme &&
31 git svn dcommit &&
fe191fca 32 git reset --hard origin/trunk &&
6ed77266
EW
33 echo aye >> README &&
34 git commit -a -m aye &&
111947ef 35 git svn dcommit &&
fe191fca 36 git reset --hard origin/b &&
111947ef
DK
37 echo spy >> README &&
38 git commit -a -m spy &&
39 echo try >> README &&
40 git commit -a -m try &&
6ed77266 41 git svn dcommit
f69e836f 42 '
6ed77266
EW
43
44test_expect_success 'run log' "
fe191fca
JH
45 git reset --hard origin/a &&
46 git svn log -r2 origin/trunk | grep ^r2 &&
47 git svn log -r4 origin/trunk | grep ^r4 &&
6ed77266
EW
48 git svn log -r3 | grep ^r3
49 "
50
51test_expect_success 'run log against a from trunk' "
fe191fca
JH
52 git reset --hard origin/trunk &&
53 git svn log -r3 origin/a | grep ^r3
6ed77266
EW
54 "
55
60f3ff12 56printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4
fede44b2
DK
57
58test_expect_success 'test ascending revision range' "
fe191fca 59 git reset --hard origin/trunk &&
82ebb0b6 60 git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
fede44b2
DK
61 "
62
9963e025 63test_expect_success 'test ascending revision range with --show-commit' "
fe191fca 64 git reset --hard origin/trunk &&
9963e025
MG
65 git svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
66 "
67
68test_expect_success 'test ascending revision range with --show-commit (sha1)' "
69 git svn find-rev r1 >expected-range-r1-r2-r4-sha1 &&
70 git svn find-rev r2 >>expected-range-r1-r2-r4-sha1 &&
71 git svn find-rev r4 >>expected-range-r1-r2-r4-sha1 &&
fe191fca 72 git reset --hard origin/trunk &&
9963e025
MG
73 git svn log --show-commit -r 1:4 | grep '^r[0-9]' | cut -d'|' -f2 >out &&
74 git rev-parse \$(cat out) >actual &&
75 test_cmp expected-range-r1-r2-r4-sha1 actual
76 "
77
60f3ff12 78printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1
fede44b2
DK
79
80test_expect_success 'test descending revision range' "
fe191fca 81 git reset --hard origin/trunk &&
82ebb0b6 82 git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -
fede44b2
DK
83 "
84
111947ef
DK
85printf 'r1 \nr2 \n' > expected-range-r1-r2
86
87test_expect_success 'test ascending revision range with unreachable revision' "
fe191fca 88 git reset --hard origin/trunk &&
82ebb0b6 89 git svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -
111947ef
DK
90 "
91
92printf 'r2 \nr1 \n' > expected-range-r2-r1
93
94test_expect_success 'test descending revision range with unreachable revision' "
fe191fca 95 git reset --hard origin/trunk &&
82ebb0b6 96 git svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -
111947ef
DK
97 "
98
99printf 'r2 \n' > expected-range-r2
100
101test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' "
fe191fca 102 git reset --hard origin/trunk &&
82ebb0b6 103 git svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -
111947ef
DK
104 "
105
106test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' "
fe191fca 107 git reset --hard origin/trunk &&
82ebb0b6 108 git svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -
111947ef
DK
109 "
110
111printf 'r4 \n' > expected-range-r4
112
113test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' "
fe191fca 114 git reset --hard origin/trunk &&
82ebb0b6 115 git svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
111947ef
DK
116 "
117
118test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' "
fe191fca 119 git reset --hard origin/trunk &&
82ebb0b6 120 git svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
111947ef
DK
121 "
122
123printf -- '------------------------------------------------------------------------\n' > expected-separator
124
125test_expect_success 'test ascending revision range with unreachable boundary revisions and no commits' "
fe191fca 126 git reset --hard origin/trunk &&
82ebb0b6 127 git svn log -r 5:6 | test_cmp expected-separator -
111947ef
DK
128 "
129
130test_expect_success 'test descending revision range with unreachable boundary revisions and no commits' "
fe191fca 131 git reset --hard origin/trunk &&
82ebb0b6 132 git svn log -r 6:5 | test_cmp expected-separator -
111947ef
DK
133 "
134
135test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' "
fe191fca 136 git reset --hard origin/trunk &&
82ebb0b6 137 git svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
111947ef
DK
138 "
139
140test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' "
fe191fca 141 git reset --hard origin/trunk &&
82ebb0b6 142 git svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
111947ef
DK
143 "
144
6ed77266 145test_done