git-p4: add tests for non-numeric revision range
Test that git-p4 can handle a sync with a non-numeric revision range (e.g. a date). Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Luke Diamand committed
Jun 10, 2015 at 08:30 UTC
eceafffbec97385eb65d7ba0c365ee028aaf1aad
1 file changed
+38
t/t9800-git-p4-basic.sh
+38
@@ -131,6 +131,44 @@ test_expect_success 'clone two dirs, @all, conflicting files' '
131
)
132
'
133
134
+revision_ranges="2000/01/01,#head \
135
+ 1,2080/01/01 \
136
+ 2000/01/01,2080/01/01 \
137
+ 2000/01/01,1000 \
138
+ 1,1000"
139
+
140
+test_expect_success 'clone using non-numeric revision ranges' '
141
+ test_when_finished cleanup_git &&
142
+ for r in $revision_ranges
143
+ do
144
+ rm -fr "$git" &&
145
+ test ! -d "$git" &&
146
+ git p4 clone --dest="$git" //depot@$r &&
147
+ (
148
+ cd "$git" &&
149
+ git ls-files >lines &&
150
+ test_line_count = 6 lines
151
+ )
152
+ done
153
+'
154
+
155
+test_expect_success 'clone with date range, excluding some changes' '
156
+ test_when_finished cleanup_git &&
157
+ before=$(date +%Y/%m/%d:%H:%M:%S) &&
158
+ sleep 2 &&
159
+ (
160
+ cd "$cli" &&
161
+ :>date_range_test &&
162
+ p4 add date_range_test &&
163
+ p4 submit -d "Adding file"
164
+ ) &&
165
+ git p4 clone --dest="$git" //depot@1,$before &&
166
+ (
167
+ cd "$git" &&
168
+ test_path_is_missing date_range_test
169
+ )
170
+'
171
+
172
test_expect_success 'exit when p4 fails to produce marshaled output' '
173
mkdir badp4dir &&
174
test_when_finished "rm badp4dir/p4 && rmdir badp4dir" &&