summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorLars Schneider <larsxschneider@gmail.com>2016-12-04 15:03:11 +0100
committerJunio C Hamano <gitster@pobox.com>2016-12-05 14:55:32 -0800
commit89a6ecc55b55ae87c39c5d9edb115731550fba95 (patch)
treea6e54354bbf5eac4f74f3b698b988011720cb0d8 /git-p4.py
parent454cb6bd52a4de614a3633e4f547af03d5c3b640 (diff)
downloadgit-89a6ecc55b55ae87c39c5d9edb115731550fba95.tar.gz
git-p4: add config to retry p4 commands; retry 3 times by default
P4 commands can fail due to random network issues. P4 users can counter these issues by using a retry flag supported by all p4 commands [1]. Add an integer Git config value `git-p4.retries` to define the number of retries for all p4 invocations. If the config is not defined then set the default retry count to 3. [1] https://www.perforce.com/perforce/doc.current/manuals/cmdref/global.options.html Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/git-p4.py b/git-p4.py
index fd5ca52462..2422178210 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -78,6 +78,11 @@ def p4_build_cmd(cmd):
if len(client) > 0:
real_cmd += ["-c", client]
+ retries = gitConfigInt("git-p4.retries")
+ if retries is None:
+ # Perform 3 retries by default
+ retries = 3
+ real_cmd += ["-r", str(retries)]
if isinstance(cmd,basestring):
real_cmd = ' '.join(real_cmd) + ' ' + cmd