git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-p4.py: fix --prepare-p4-only error with multiple commits

From
Ben Keene via GitGitGadget <gitgitgadget@gmail.com>
Date
May 1, 2020, 17:09 UTC
Message-ID
<pull.775.git.git.1588352952840.gitgitgadget@gmail.com>
From: Ben Keene <seraphire@gmail.com>

When using git p4 submit with the --prepare-p4-only option, the program should prepare a single p4 changelist and notify the user that more commits are pending and then stop processing.

A bug has been introduced by the p4-changelist hook feature that causes the program to continue to try and process all pending changelists at the same time.

The function applyCommit should return True when applying the commit was successful and the program should continue. In the case of the --prepare-p4-only flag, the function should return False, alerting the caller that the program should not proceed with additional commits.

Change the return value from True to False in the applyCommit function when git-p4 is executed with --prepare-p4-only flag.

Signed-off-by: Ben Keene <seraphire@gmail.com>
---
    git-p4.py: fix --prepare-p4-only error with multiple commits
    
    When using git p4 submit with the --prepare-p4-only option, the program
    should prepare a single p4 changelist and notify the user that more
    commits are pending and then stop processing.
    
    A bug has been introduced by the p4-changelist hook feature that causes
    the program to continue to try and process all pending changelists at
    the same time.
    
    The function applyCommit should return True when applying the commit was
    successful and the program should continue. In the case of the
    --prepare-p4-only flag, the function should return False, alerting the
    caller that the program should not proceed with additional commits.
    
    Change the return value from True to False in the applyCommit function
    when git-p4 is executed with --prepare-p4-only flag.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-775%2Fseraphire%2Fseraphire%2Fp4-hook-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-775/seraphire/seraphire/p4-hook-v1
Pull-Request: https://github.com/git/git/pull/775
 git-p4.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-p4.py b/git-p4.py
index b8b2a1679e7..d9ced1bf552 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1984,7 +1984,7 @@ def get_diff_description(self, editedFiles, filesToAdd, symlinks):
         return (diff + newdiff).replace('\r\n', '\n')
 
     def applyCommit(self, id):
-        """Apply one commit, return True if it succeeded."""
+        """Apply one commit, return True if it should continue processing."""
 
         print("Applying", read_pipe(["git", "show", "-s",
                                      "--format=format:%h %s", id]))
@@ -2222,7 +2222,7 @@ def applyCommit(self, id):
                         print("  " + f)
                 print("")
                 sys.stdout.flush()
-                return True
+                return False
 
             if self.edit_template(fileName):
                 if not self.no_verify:

base-commit: d61d20c9b413225793f8a0b491bbbec61c184e26
-- 
gitgitgadget
Next: Junio C Hamano
Message 1 of 6 in “git-p4.py: fix --prepare-p4-only error with multiple commits”
  1. git-p4.py: fix --prepare-p4-only error with multiple commitsBen Keene via GitGitGadget, May 1, 2020
  2. Junio C HamanoMay 1, 2020
  3. Junio C HamanoMay 6, 2020
  4. git-p4.py: fix --prepare-p4-only error with multiple commitsBen Keene via GitGitGadget, May 12, 2020
  5. Junio C HamanoMay 12, 2020
  6. Luke DiamandMay 17, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.