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

[PATCH v2 0/4] git-p4: add hook p4-pre-edit-changelist

From
Ben Keene via GitGitGadget <gitgitgadget@gmail.com>
Date
Jan 31, 2020, 21:58 UTC
Message-ID
<pull.698.v2.git.git.1580507895.gitgitgadget@gmail.com>
In-Reply-To
<pull.698.git.git.1579555036314.gitgitgadget@gmail.com>

Our company's workflow requires that our P4 check-in messages have a specific format. A helpful feature in the GIT-P4 program would be a hook that occurs after the P4 change list is created but before it is displayed in the editor that would allow an external program to possibly edit the changelist text.

v1:My suggestion for the hook name is p4-pre-edit-changelist.

It would take a single parameter, the full path of the temporary file. If the hook returns a non-zero exit code, it would cancel the current P4 submit.

The hook should be optional.

v2:Instead of a single hook, p4-pre-edit-changelist, follow the git convention for hook names and add the trio of hooks that work together, similar to git commit.

The hook names are: 
 * p4-prepare-changelist
 * p4-changelist
 * p4-post-changelist

The hooks should follow the same convention as git commit, so a new command line option for the git-p4 submit function --no-verify should also be added.

Ben Keene (4):
  git-p4: rewrite prompt to be Windows compatible
  git-p4: create new method gitRunHook
  git-p4: add hook p4-pre-edit-changelist
  git-p4: add p4 submit hooks
 Documentation/git-p4.txt   |  44 ++++++++-
 Documentation/githooks.txt |  46 +++++++++
 git-p4.py                  | 191 ++++++++++++++++++++++++++-----------
 3 files changed, 225 insertions(+), 56 deletions(-)
base-commit: 5b0ca878e008e82f91300091e793427205ce3544
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-698%2Fseraphire%2Fseraphire%2Fp4-hook-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-698/seraphire/seraphire/p4-hook-v2
Pull-Request: https://github.com/git/git/pull/698
Range-diff vs v1:
 -:  ---------- > 1:  585bdd51b2 git-p4: rewrite prompt to be Windows compatible
 -:  ---------- > 2:  f1f9fdc542 git-p4: create new method gitRunHook
 1:  bb3ce3a795 ! 3:  1bdcdc4c18 git-p4: Add hook p4-pre-pedit-changelist
     @@ -1,6 +1,6 @@
      Author: Ben Keene <seraphire@gmail.com>
      
     -    git-p4: Add hook p4-pre-pedit-changelist
     +    git-p4: add hook p4-pre-edit-changelist
      
          Add an additional hook to the git-p4 command to allow a hook to modify
          the text of the changelist prior to displaying the p4editor command.
 -:  ---------- > 4:  3d34dd042e git-p4: add p4 submit hooks
-- 
gitgitgadget
Previous: Ben KeeneNext: Ben Keene via GitGitGadget
Message 11 of 57 in “git-p4: Add hook p4-pre-pedit-changelist”
  1. git-p4: Add hook p4-pre-pedit-changelistBen Keene via GitGitGadget, Jan 20, 2020
  2. Junio C HamanoJan 21, 2020
  3. Luke DiamandJan 29, 2020
  4. Junio C HamanoJan 29, 2020
  5. Luke DiamandJan 29, 2020
  6. Junio C HamanoJan 30, 2020
  7. Ben KeeneJan 30, 2020
  8. Junio C HamanoJan 30, 2020
  9. Bryan TurnerJan 30, 2020
  10. Ben KeeneJan 30, 2020
  11. 0/4 git-p4: add hook p4-pre-edit-changelistBen Keene via GitGitGadget, Jan 31, 2020
  12. 1/4 git-p4: rewrite prompt to be Windows compatibleBen Keene via GitGitGadget, Jan 31, 2020
  13. 3/4 git-p4: add hook p4-pre-edit-changelistBen Keene via GitGitGadget, Jan 31, 2020
  14. 2/4 git-p4: create new method gitRunHookBen Keene via GitGitGadget, Jan 31, 2020
  15. Junio C HamanoFeb 4, 2020
  16. Ben KeeneFeb 5, 2020
  17. Junio C HamanoFeb 5, 2020
  18. Ben KeeneFeb 6, 2020
  19. Junio C HamanoFeb 6, 2020
  20. 4/4 git-p4: add p4 submit hooksBen Keene via GitGitGadget, Jan 31, 2020
  21. Junio C HamanoFeb 4, 2020
  22. 0/5 git-p4: add hook p4-pre-edit-changelistBen Keene via GitGitGadget, Feb 6, 2020
  23. 1/5 git-p4: rewrite prompt to be Windows compatibleBen Keene via GitGitGadget, Feb 6, 2020
  24. Junio C HamanoFeb 6, 2020
  25. Ben KeeneFeb 10, 2020
  26. 2/5 git-p4: create new function run_git_hookBen Keene via GitGitGadget, Feb 6, 2020
  27. Junio C HamanoFeb 6, 2020
  28. Ben KeeneFeb 10, 2020
  29. 3/5 git-p4: add --no-verify optionBen Keene via GitGitGadget, Feb 6, 2020
  30. Junio C HamanoFeb 6, 2020
  31. Ben KeeneFeb 10, 2020
  32. 4/5 git-p4: restructure code in submitBen Keene via GitGitGadget, Feb 6, 2020
  33. 5/5 git-p4: add p4 submit hooksBen Keene via GitGitGadget, Feb 6, 2020
  34. 0/6 git-p4: add hooks for p4-changelistBen Keene via GitGitGadget, Feb 10, 2020
  35. 1/6 git-p4: rewrite prompt to be Windows compatibleBen Keene via GitGitGadget, Feb 10, 2020
  36. 4/6 git-p4: restructure code in submitBen Keene via GitGitGadget, Feb 10, 2020
  37. 6/6 git-4: add RCS keyword status messageBen Keene via GitGitGadget, Feb 10, 2020
  38. 2/6 git-p4: create new function run_git_hookBen Keene via GitGitGadget, Feb 10, 2020
  39. Junio C HamanoFeb 10, 2020
  40. 3/6 git-p4: add --no-verify optionBen Keene via GitGitGadget, Feb 10, 2020
  41. 5/6 git-p4: add p4 submit hooksBen Keene via GitGitGadget, Feb 10, 2020
  42. 0/7 git-p4: add hooks for p4-changelistBen Keene via GitGitGadget, Feb 11, 2020
  43. 1/7 git-p4: rewrite prompt to be Windows compatibleBen Keene via GitGitGadget, Feb 11, 2020
  44. 2/7 git-p4: create new function run_git_hookBen Keene via GitGitGadget, Feb 11, 2020
  45. 5/7 git-p4: restructure code in submitBen Keene via GitGitGadget, Feb 11, 2020
  46. 6/7 git-p4: add p4 submit hooksBen Keene via GitGitGadget, Feb 11, 2020
  47. 3/7 git-p4: add p4-pre-submit exit textBen Keene via GitGitGadget, Feb 11, 2020
  48. 4/7 git-p4: add --no-verify optionBen Keene via GitGitGadget, Feb 11, 2020
  49. 7/7 git-p4: add RCS keyword status messageBen Keene via GitGitGadget, Feb 11, 2020
  50. 0/7 git-p4: add hooks for p4-changelistBen Keene via GitGitGadget, Feb 14, 2020
  51. 1/7 git-p4: rewrite prompt to be Windows compatibleBen Keene via GitGitGadget, Feb 14, 2020
  52. 2/7 git-p4: create new function run_git_hookBen Keene via GitGitGadget, Feb 14, 2020
  53. 3/7 git-p4: add p4-pre-submit exit textBen Keene via GitGitGadget, Feb 14, 2020
  54. 5/7 git-p4: restructure code in submitBen Keene via GitGitGadget, Feb 14, 2020
  55. 4/7 git-p4: add --no-verify optionBen Keene via GitGitGadget, Feb 14, 2020
  56. 6/7 git-p4: add p4 submit hooksBen Keene via GitGitGadget, Feb 14, 2020
  57. 7/7 git-p4: add RCS keyword status messageBen Keene via GitGitGadget, Feb 14, 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.