git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] git-p4: add config to retry p4 commands; retry 3 times by default
@ 2016-12-04 14:03 larsxschneider
  2016-12-05  9:09 ` Lars Schneider
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: larsxschneider @ 2016-12-04 14:03 UTC (permalink / raw)
  To: git; +Cc: luke, orirawlings, Lars Schneider, Lars Schneider

From: Lars Schneider <lars.schneider@autodesk.com>

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>
---

Notes:
    Base Commit: 454cb6b (v2.11.0)
    Diff on Web: https://github.com/git/git/compare/454cb6b...larsxschneider:654c727
    Checkout:    git fetch https://github.com/larsxschneider/git git-p4/retries-v1 && git checkout 654c727

 Documentation/git-p4.txt | 4 ++++
 git-p4.py                | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt
index c83aaf39c3..656587248c 100644
--- a/Documentation/git-p4.txt
+++ b/Documentation/git-p4.txt
@@ -467,6 +467,10 @@ git-p4.client::
 	Client specified as an option to all p4 commands, with
 	'-c <client>', including the client spec.
 
+git-p4.retries::
+	Specifies the number of times to retry a p4 command (notably,
+	'p4 sync') if the network times out. The default value is 3.
+
 Clone and sync variables
 ~~~~~~~~~~~~~~~~~~~~~~~~
 git-p4.syncFromOrigin::
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
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] git-p4: add config to retry p4 commands; retry 3 times by default
  2016-12-04 14:03 [PATCH v1] git-p4: add config to retry p4 commands; retry 3 times by default larsxschneider
@ 2016-12-05  9:09 ` Lars Schneider
  2016-12-05 11:02 ` Luke Diamand
  2016-12-05 21:19 ` Ori Rawlings
  2 siblings, 0 replies; 4+ messages in thread
From: Lars Schneider @ 2016-12-05  9:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git


> On 04 Dec 2016, at 15:03, larsxschneider@gmail.com wrote:
> 
> From: Lars Schneider <lars.schneider@autodesk.com>

Hi Junio,

if you decide to queue this patch and/or the "git-p4: fix empty file 
processing for large file system backend GitLFS", please use my 
signed-off address. I accidentally messed up the author field in
both.

Thanks,
Lars


> 
> 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>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] git-p4: add config to retry p4 commands; retry 3 times by default
  2016-12-04 14:03 [PATCH v1] git-p4: add config to retry p4 commands; retry 3 times by default larsxschneider
  2016-12-05  9:09 ` Lars Schneider
@ 2016-12-05 11:02 ` Luke Diamand
  2016-12-05 21:19 ` Ori Rawlings
  2 siblings, 0 replies; 4+ messages in thread
From: Luke Diamand @ 2016-12-05 11:02 UTC (permalink / raw)
  To: Lars Schneider; +Cc: Git Users, Ori Rawlings, Lars Schneider

On 4 December 2016 at 14:03,  <larsxschneider@gmail.com> wrote:
> From: Lars Schneider <lars.schneider@autodesk.com>
>
> 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.

Looks good to me, ack.

>
> [1] https://www.perforce.com/perforce/doc.current/manuals/cmdref/global.options.html
>
> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
> ---
>
> Notes:
>     Base Commit: 454cb6b (v2.11.0)
>     Diff on Web: https://github.com/git/git/compare/454cb6b...larsxschneider:654c727
>     Checkout:    git fetch https://github.com/larsxschneider/git git-p4/retries-v1 && git checkout 654c727
>
>  Documentation/git-p4.txt | 4 ++++
>  git-p4.py                | 5 +++++
>  2 files changed, 9 insertions(+)
>
> diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt
> index c83aaf39c3..656587248c 100644
> --- a/Documentation/git-p4.txt
> +++ b/Documentation/git-p4.txt
> @@ -467,6 +467,10 @@ git-p4.client::
>         Client specified as an option to all p4 commands, with
>         '-c <client>', including the client spec.
>
> +git-p4.retries::
> +       Specifies the number of times to retry a p4 command (notably,
> +       'p4 sync') if the network times out. The default value is 3.
> +
>  Clone and sync variables
>  ~~~~~~~~~~~~~~~~~~~~~~~~
>  git-p4.syncFromOrigin::
> 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
> --
> 2.11.0
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] git-p4: add config to retry p4 commands; retry 3 times by default
  2016-12-04 14:03 [PATCH v1] git-p4: add config to retry p4 commands; retry 3 times by default larsxschneider
  2016-12-05  9:09 ` Lars Schneider
  2016-12-05 11:02 ` Luke Diamand
@ 2016-12-05 21:19 ` Ori Rawlings
  2 siblings, 0 replies; 4+ messages in thread
From: Ori Rawlings @ 2016-12-05 21:19 UTC (permalink / raw)
  To: Git Users

Looks good to me, too.

-r flag seems to be supported as far back as I can search in the Helix
release notes.

Ori Rawlings

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-05 21:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-04 14:03 [PATCH v1] git-p4: add config to retry p4 commands; retry 3 times by default larsxschneider
2016-12-05  9:09 ` Lars Schneider
2016-12-05 11:02 ` Luke Diamand
2016-12-05 21:19 ` Ori Rawlings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).