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

[PATCH] git p4 submit: Add --{skip-,}edit-submit option

From
CLCrestez Dan Leonard <cdleonard@gmail.com>
Date
Feb 26, 2014, 12:26 UTC
Message-ID
<a6da387cdf3214fd7216ff980d2916aae055d4d9.1393417604.git.cdleonard@gmail.com>

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 <cdleonard@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
Message 1 of 1 in “git p4 submit: Add --{skip-,}edit-submit option”
  1. git p4 submit: Add --{skip-,}edit-submit optionCrestez Dan Leonard, Feb 26, 2014

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.