{"thread":{"id":"35958","subject":"[PATCH] git p4 submit: Add --{skip-,}edit-submit option","startedAt":"2014-02-26T12:26:45Z","lastAt":"2014-02-26T12:26:45Z","messageCount":1,"participants":["Crestez Dan Leonard"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"235381","messageId":"a6da387cdf3214fd7216ff980d2916aae055d4d9.1393417604.git.cdleonard@gmail.com","threadId":"35958","inReplyTo":null,"subject":"[PATCH] git p4 submit: Add --{skip-,}edit-submit option","fromName":"Crestez Dan Leonard","fromEmail":"cdleonard@gmail.com","sentAt":"2014-02-26T12:26:45Z","receivedAt":"2014-02-26T12:26:45Z","isPatch":true,"sender":{"key":"cdleonard@gmail.com","avatar":null},"body":"\nThis allows skipping interactively editting the p4 changelist before\nsubmit. This is useful for pushing series of patches to p4 quickly.\n\nThis was already possible through a config option.\n\nSigned-off-by: Crestez Dan Leonard <cdleonard@gmail.com>\n---\n Documentation/git-p4.txt |  4 ++++\n git-p4.py                | 11 ++++++++++-\n 2 files changed, 14 insertions(+), 1 deletion(-)\n\n\n\ndiff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt\nindex 6ab5f94..619f45f 100644\n--- a/Documentation/git-p4.txt\n+++ b/Documentation/git-p4.txt\n@@ -299,6 +299,10 @@ These options can be used to modify 'git p4 submit' behavior.\n \tto bypass the prompt, causing conflicting commits to be automatically\n \tskipped, or to quit trying to apply commits, without prompting.\n \n+--skip-submit-edit --edit-submit::\n+\tEdit the changelist before template or not. This defaults to true,\n+\tunless overridden by the git-p4.skipSubmitEdit config option.\n+\n --branch <branch>::\n \tAfter submitting, sync this named branch instead of the default\n \tp4/master.  See the \"Sync options\" section above for more\ndiff --git a/git-p4.py b/git-p4.py\nindex cdfa2df..cafd997 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -998,6 +998,10 @@ class P4Submit(Command, P4UserMap):\n                 optparse.make_option(\"--prepare-p4-only\", dest=\"prepare_p4_only\", action=\"store_true\"),\n                 optparse.make_option(\"--conflict\", dest=\"conflict_behavior\",\n                                      choices=self.conflict_behavior_choices),\n+                optparse.make_option(\"--skip-edit-submit\", dest=\"edit_submit\", action=\"store_true\",\n+                        help=\"Skip editting the changelist before submit\"),\n+                optparse.make_option(\"--edit-submit\", dest=\"edit_submit\", action=\"store_false\",\n+                        help=\"Edit the changelist before submit (default)\"),\n                 optparse.make_option(\"--branch\", dest=\"branch\"),\n         ]\n         self.description = \"Submit changes from git to the perforce depot.\"\n@@ -1203,12 +1207,17 @@ class P4Submit(Command, P4UserMap):\n \n         return template\n \n+    def get_edit_submit_value(self):\n+        if hasattr(self, 'edit_submit'):\n+            return self.edit_submit\n+        return gitConfigBool('git-p4.skipSubmitEdit')\n+\n     def edit_template(self, template_file):\n         \"\"\"Invoke the editor to let the user change the submission\n            message.  Return true if okay to continue with the submit.\"\"\"\n \n         # if configured to skip the editing part, just submit\n-        if gitConfigBool(\"git-p4.skipSubmitEdit\"):\n+        if self.get_edit_submit_value():\n             return True\n \n         # look at the modification time, to check later if the user saved\n"}]}