This allows skipping interactively editting the p4 changelist before
submit. This is useful for pushing series of patches to p4 quickly.

This was already possible through a config option.

Signed-off-by: Crestez Dan Leonard <cdleon...@gmail.com>
---
 Documentation/git-p4.txt |  4 ++++
 git-p4.py                | 11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt
index 6ab5f94..619f45f 100644
--- a/Documentation/git-p4.txt
+++ b/Documentation/git-p4.txt
@@ -299,6 +299,10 @@ These options can be used to modify 'git p4 submit' behavior.
 	to bypass the prompt, causing conflicting commits to be automatically
 	skipped, or to quit trying to apply commits, without prompting.
 
+--skip-submit-edit --edit-submit::
+	Edit the changelist before template or not. This defaults to true,
+	unless overridden by the git-p4.skipSubmitEdit config option.
+
 --branch <branch>::
 	After submitting, sync this named branch instead of the default
 	p4/master.  See the "Sync options" section above for more
diff --git a/git-p4.py b/git-p4.py
index cdfa2df..cafd997 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -998,6 +998,10 @@ class P4Submit(Command, P4UserMap):
                 optparse.make_option("--prepare-p4-only", dest="prepare_p4_only", action="store_true"),
                 optparse.make_option("--conflict", dest="conflict_behavior",
                                      choices=self.conflict_behavior_choices),
+                optparse.make_option("--skip-edit-submit", dest="edit_submit", action="store_true",
+                        help="Skip editting the changelist before submit"),
+                optparse.make_option("--edit-submit", dest="edit_submit", action="store_false",
+                        help="Edit the changelist before submit (default)"),
                 optparse.make_option("--branch", dest="branch"),
         ]
         self.description = "Submit changes from git to the perforce depot."
@@ -1203,12 +1207,17 @@ class P4Submit(Command, P4UserMap):
 
         return template
 
+    def get_edit_submit_value(self):
+        if hasattr(self, 'edit_submit'):
+            return self.edit_submit
+        return gitConfigBool('git-p4.skipSubmitEdit')
+
     def edit_template(self, template_file):
         """Invoke the editor to let the user change the submission
            message.  Return true if okay to continue with the submit."""
 
         # if configured to skip the editing part, just submit
-        if gitConfigBool("git-p4.skipSubmitEdit"):
+        if self.get_edit_submit_value():
             return True
 
         # look at the modification time, to check later if the user saved

Reply via email to