git-p4: add tests for non-numeric revision range
authorLuke Diamand <luke@diamand.org>
Wed, 10 Jun 2015 07:30:58 +0000 (08:30 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 10 Jun 2015 15:29:10 +0000 (08:29 -0700)
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>
t/t9800-git-p4-basic.sh
index 5b562122a16f231b00f7fb8090992f49d4950d82..90d41ed954c829bfb3735f3cea9db336f74adb81 100755 (executable)
@@ -131,6 +131,44 @@ test_expect_success 'clone two dirs, @all, conflicting files' '
        )
 '
 
+revision_ranges="2000/01/01,#head \
+                1,2080/01/01 \
+                2000/01/01,2080/01/01 \
+                2000/01/01,1000 \
+                1,1000"
+
+test_expect_success 'clone using non-numeric revision ranges' '
+       test_when_finished cleanup_git &&
+       for r in $revision_ranges
+       do
+               rm -fr "$git" &&
+               test ! -d "$git" &&
+               git p4 clone --dest="$git" //depot@$r &&
+               (
+                       cd "$git" &&
+                       git ls-files >lines &&
+                       test_line_count = 6 lines
+               )
+       done
+'
+
+test_expect_success 'clone with date range, excluding some changes' '
+       test_when_finished cleanup_git &&
+       before=$(date +%Y/%m/%d:%H:%M:%S) &&
+       sleep 2 &&
+       (
+               cd "$cli" &&
+               :>date_range_test &&
+               p4 add date_range_test &&
+               p4 submit -d "Adding file"
+       ) &&
+       git p4 clone --dest="$git" //depot@1,$before &&
+       (
+               cd "$git" &&
+               test_path_is_missing date_range_test
+       )
+'
+
 test_expect_success 'exit when p4 fails to produce marshaled output' '
        mkdir badp4dir &&
        test_when_finished "rm badp4dir/p4 && rmdir badp4dir" &&