summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLuke Diamand <luke@diamand.org>2018-06-08 20:32:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-06-12 21:46:09 (GMT)
commit3deed5e078f2998573589b1ca03d89f41ea346e9 (patch)
tree7d2c3fd209beb8884a1b0ac3318c16a10c224846 /t
parent8fa0abf830ef3c8e97846cef0986589b49bcfe6f (diff)
downloadgit-3deed5e078f2998573589b1ca03d89f41ea346e9.zip
git-3deed5e078f2998573589b1ca03d89f41ea346e9.tar.gz
git-3deed5e078f2998573589b1ca03d89f41ea346e9.tar.bz2
git-p4: auto-size the block
git-p4 originally would fetch changes in one query. On large repos this could fail because of the limits that Perforce imposes on the number of items returned and the number of queries in the database. To fix this, git-p4 learned to query changes in blocks of 512 changes, However, this can be very slow - if you have a few million changes, with each chunk taking about a second, it can be an hour or so. Although it's possible to tune this value manually with the "--changes-block-size" option, it's far from obvious to ordinary users that this is what needs doing. This change alters the block size dynamically by looking for the specific error messages returned from the Perforce server, and reducing the block size if the error is seen, either to the limit reported by the server, or to half the current block size. That means we can start out with a very large block size, and then let it automatically drop down to a value that works without error, while still failing correctly if some other error occurs. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t9818-git-p4-block.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t9818-git-p4-block.sh b/t/t9818-git-p4-block.sh
index 8840a18..ce7cb22 100755
--- a/t/t9818-git-p4-block.sh
+++ b/t/t9818-git-p4-block.sh
@@ -129,6 +129,7 @@ test_expect_success 'Create a repo with multiple depot paths' '
'
test_expect_success 'Clone repo with multiple depot paths' '
+ test_when_finished cleanup_git &&
(
cd "$git" &&
git p4 clone --changes-block-size=4 //depot/pathA@all //depot/pathB@all \
@@ -138,6 +139,13 @@ test_expect_success 'Clone repo with multiple depot paths' '
)
'
+test_expect_success 'Clone repo with self-sizing block size' '
+ test_when_finished cleanup_git &&
+ git p4 clone --changes-block-size=1000000 //depot@all --destination="$git" &&
+ git -C "$git" log --oneline >log &&
+ test_line_count \> 10 log
+'
+
test_expect_success 'kill p4d' '
kill_p4d
'