diff options
author | Ben Keene <seraphire@gmail.com> | 2020-05-12 13:15:59 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-05-12 12:42:32 -0700 |
commit | 2dfdd705ffd8c6dd1ef75abdfb64e1a08ad35a26 (patch) | |
tree | ade6763b51b34fbe730ab9b1a1e11f135bf14abd | |
parent | The fifth batch (diff) | |
download | tgif-2dfdd705ffd8c6dd1ef75abdfb64e1a08ad35a26.tar.xz |
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 returns True when applying the commit
was successful and the program should continue. However, when the
optional flag --prepare-p4-only is set, the program should stop
after the first application.
Change the logic in the run method for P4Submit to check for the
flag --prepare-p4-only after successfully completing the applyCommit
method.
Be aware - this change will fix the existing test error in t9807.23
for --prepare-p4-only. However there is insufficent coverage for
this flag. If more than 1 commit is pending submission to P4, the
method will properly prepare the P4 changelist, however it will
still exit the application with an exitcode of 1.
The current documentation does not define what the exit code should be
in this condition.
(See: https://git-scm.com/docs/git-p4#Documentation/git-p4.txt---prepare-p4-only)
Signed-off-by: Ben Keene <seraphire@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | git-p4.py | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -2537,11 +2537,12 @@ class P4Submit(Command, P4UserMap): ok = self.applyCommit(commit) if ok: applied.append(commit) - else: - if self.prepare_p4_only and i < last: - print("Processing only the first commit due to option" \ - " --prepare-p4-only") + if self.prepare_p4_only: + if i < last: + print("Processing only the first commit due to option" \ + " --prepare-p4-only") break + else: if i < last: # prompt for what to do, or use the option/variable if self.conflict_behavior == "ask": |