[v2,4/4] git-p4: failure because of RCS keywords should show help
diff mbox series

Message ID 50e9a175c3323074ceec848c0d4054edd240e862.1575991375.git.gitgitgadget@gmail.com
State New
Headers show
Series
  • git-p4: Usability enhancements
Related show

Commit Message

Heba Waly via GitGitGadget Dec. 10, 2019, 3:22 p.m. UTC
From: Ben Keene <seraphire@gmail.com>

When applying a commit fails because of RCS keywords, Git
will fail the P4 submit. It would help the user if Git suggested that
the user set git-p4.attemptRCSCleanup to true.

Change the applyCommit() method that when applying a commit fails
becasue of the P4 RCS Keywords, the user should consider setting
git-p4.attemptRCSCleanup to true.

Signed-off-by: Ben Keene <seraphire@gmail.com>
---
 git-p4.py | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Denton Liu Dec. 11, 2019, 11:29 a.m. UTC | #1
On Tue, Dec 10, 2019 at 03:22:54PM +0000, Ben Keene via GitGitGadget wrote:
> From: Ben Keene <seraphire@gmail.com>
> 
> When applying a commit fails because of RCS keywords, Git
> will fail the P4 submit. It would help the user if Git suggested that
> the user set git-p4.attemptRCSCleanup to true.
> 
> Change the applyCommit() method that when applying a commit fails
> becasue of the P4 RCS Keywords, the user should consider setting
> git-p4.attemptRCSCleanup to true.
> 
> Signed-off-by: Ben Keene <seraphire@gmail.com>
> ---
>  git-p4.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/git-p4.py b/git-p4.py
> index 174200bb6c..cb594baeef 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -1959,6 +1959,14 @@ def applyCommit(self, id):
>                          for f in editedFiles:
>                              p4_revert(f)
>                          raise
> +            else:
> +                # They do not have attemptRCSCleanup set, this might be the fail point
> +                # Check to see if the file has RCS keywords and suggest setting the property.
> +                for file in editedFiles | filesToDelete:
> +                    if p4_keywords_regexp_for_file(file) != None:

small nit: we should use `is not None` here.

> +                        print("At least one file in this commit has RCS Keywords that may be causing problems. ")
> +                        print("Consider:\ngit config git-p4.attemptRCSCleanup true")
> +                        break
>  
>              if fixed_rcs_keywords:
>                  print("Retrying the patch with RCS keywords cleaned up")
> -- 
> gitgitgadget

Patch
diff mbox series

diff --git a/git-p4.py b/git-p4.py
index 174200bb6c..cb594baeef 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1959,6 +1959,14 @@  def applyCommit(self, id):
                         for f in editedFiles:
                             p4_revert(f)
                         raise
+            else:
+                # They do not have attemptRCSCleanup set, this might be the fail point
+                # Check to see if the file has RCS keywords and suggest setting the property.
+                for file in editedFiles | filesToDelete:
+                    if p4_keywords_regexp_for_file(file) != None:
+                        print("At least one file in this commit has RCS Keywords that may be causing problems. ")
+                        print("Consider:\ngit config git-p4.attemptRCSCleanup true")
+                        break
 
             if fixed_rcs_keywords:
                 print("Retrying the patch with RCS keywords cleaned up")