git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Crestez Dan Leonard <cdleonard@gmail.com>
To: git@vger.kernel.org
Cc: Pete Wyckoff <pw@padd.com>
Subject: [PATCH] git p4 submit: Add --{skip-,}edit-submit option
Date: Wed, 26 Feb 2014 14:26:45 +0200	[thread overview]
Message-ID: <a6da387cdf3214fd7216ff980d2916aae055d4d9.1393417604.git.cdleonard@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]


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(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-git-p4-submit-Add-skip-edit-submit-option.patch --]
[-- Type: text/x-patch; name="0001-git-p4-submit-Add-skip-edit-submit-option.patch", Size: 2332 bytes --]

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	other threads:[~2014-02-26 12:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a6da387cdf3214fd7216ff980d2916aae055d4d9.1393417604.git.cdleonard@gmail.com \
    --to=cdleonard@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pw@padd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).