Skip to content

Commit 0ff62b6

Browse files
committed
Merge branch 'bk/p4-pre-edit-changelist' into pu
"git p4" learned four new hooks and also "--no-verify" option to bypass them (and the existing "p4-pre-submit" hook). * bk/p4-pre-edit-changelist: git-p4: add RCS keyword status message git-p4: add p4 submit hooks git-p4: restructure code in submit git-p4: add --no-verify option git-p4: add p4-pre-submit exit text git-p4: create new function run_git_hook git-p4: rewrite prompt to be Windows compatible
2 parents 96bc3f9 + 1ec4a0a commit 0ff62b6

File tree

3 files changed

+274
-58
lines changed

3 files changed

+274
-58
lines changed

Documentation/git-p4.txt

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,55 @@ These options can be used to modify 'git p4 submit' behavior.
374374
been submitted. Implies --disable-rebase. Can also be set with
375375
git-p4.disableP4Sync. Sync with origin/master still goes ahead if possible.
376376

377-
Hook for submit
378-
~~~~~~~~~~~~~~~
377+
Hooks for submit
378+
----------------
379+
380+
p4-pre-submit
381+
~~~~~~~~~~~~~
382+
379383
The `p4-pre-submit` hook is executed if it exists and is executable.
380384
The hook takes no parameters and nothing from standard input. Exiting with
381385
non-zero status from this script prevents `git-p4 submit` from launching.
386+
It can be bypassed with the `--no-verify` command line option.
382387

383388
One usage scenario is to run unit tests in the hook.
384389

390+
p4-prepare-changelist
391+
~~~~~~~~~~~~~~~~~~~~~
392+
393+
The `p4-prepare-changelist` hook is executed right after preparing
394+
the default changelist message and before the editor is started.
395+
It takes one parameter, the name of the file that contains the
396+
changelist text. Exiting with a non-zero status from the script
397+
will abort the process.
398+
399+
The purpose of the hook is to edit the message file in place,
400+
and it is not supressed by the `--no-verify` option. This hook
401+
is called even if `--prepare-p4-only` is set.
402+
403+
p4-changelist
404+
~~~~~~~~~~~~~
405+
406+
The `p4-changelist` hook is executed after the changelist
407+
message has been edited by the user. It can be bypassed with the
408+
`--no-verify` option. It takes a single parameter, the name
409+
of the file that holds the proposed changelist text. Exiting
410+
with a non-zero status causes the command to abort.
411+
412+
The hook is allowed to edit the changelist file and can be used
413+
to normalize the text into some project standard format. It can
414+
also be used to refuse the Submit after inspect the message file.
415+
416+
p4-post-changelist
417+
~~~~~~~~~~~~~~~~~~
418+
419+
The `p4-post-changelist` hook is invoked after the submit has
420+
successfully occured in P4. It takes no parameters and is meant
421+
primarily for notification and cannot affect the outcome of the
422+
git p4 submit action.
423+
424+
425+
385426
Rebase options
386427
~~~~~~~~~~~~~~
387428
These options can be used to modify 'git p4 rebase' behavior.

Documentation/githooks.txt

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,61 @@ The exit status determines whether git will use the data from the
522522
hook to limit its search. On error, it will fall back to verifying
523523
all files and folders.
524524

525+
p4-changelist
526+
~~~~~~~~~~~~~
527+
528+
This hook is invoked by `git-p4 submit`.
529+
530+
The `p4-changelist` hook is executed after the changelist
531+
message has been edited by the user. It can be bypassed with the
532+
`--no-verify` option. It takes a single parameter, the name
533+
of the file that holds the proposed changelist text. Exiting
534+
with a non-zero status causes the command to abort.
535+
536+
The hook is allowed to edit the changelist file and can be used
537+
to normalize the text into some project standard format. It can
538+
also be used to refuse the Submit after inspect the message file.
539+
540+
Run `git-p4 submit --help` for details.
541+
542+
p4-prepare-changelist
543+
~~~~~~~~~~~~~~~~~~~~~
544+
545+
This hook is invoked by `git-p4 submit`.
546+
547+
The `p4-prepare-changelist` hook is executed right after preparing
548+
the default changelist message and before the editor is started.
549+
It takes one parameter, the name of the file that contains the
550+
changelist text. Exiting with a non-zero status from the script
551+
will abort the process.
552+
553+
The purpose of the hook is to edit the message file in place,
554+
and it is not supressed by the `--no-verify` option. This hook
555+
is called even if `--prepare-p4-only` is set.
556+
557+
Run `git-p4 submit --help` for details.
558+
559+
p4-post-changelist
560+
~~~~~~~~~~~~~~~~~~
561+
562+
This hook is invoked by `git-p4 submit`.
563+
564+
The `p4-post-changelist` hook is invoked after the submit has
565+
successfully occured in P4. It takes no parameters and is meant
566+
primarily for notification and cannot affect the outcome of the
567+
git p4 submit action.
568+
569+
Run `git-p4 submit --help` for details.
570+
525571
p4-pre-submit
526572
~~~~~~~~~~~~~
527573

528574
This hook is invoked by `git-p4 submit`. It takes no parameters and nothing
529575
from standard input. Exiting with non-zero status from this script prevent
530-
`git-p4 submit` from launching. Run `git-p4 submit --help` for details.
576+
`git-p4 submit` from launching. It can be bypassed with the `--no-verify`
577+
command line option. Run `git-p4 submit --help` for details.
578+
579+
531580

532581
post-index-change
533582
~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)