From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [PATCH] Allow hand-editing of patches before sending
Date: Wed, 01 Nov 2006 10:00:46 +0100 [thread overview]
Message-ID: <20061101090046.1107.81105.stgit@localhost> (raw)
From: Karl Hasselström <kha@treskal.com>
This adds a new flag to 'stg mail', allowing the user to hand-edit
each patch e-mail before it is sent, just like it is currently
possible to edit the cover message.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
Intended use is to allow the user to write comments like this, when
there is only one patch and a cover mail would be overkill.
stgit/commands/mail.py | 59 ++++++++++++++++++++++++++++--------------------
1 files changed, 35 insertions(+), 24 deletions(-)
diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
index 970ae3e..26c711d 100644
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -108,6 +108,9 @@ options = [make_option('-a', '--all',
make_option('-e', '--edit',
help = 'edit the cover message before sending',
action = 'store_true'),
+ make_option('-E', '--edit-patches',
+ help = 'edit each patch before sending',
+ action = 'store_true'),
make_option('-s', '--sleep', type = 'int', metavar = 'SECONDS',
help = 'sleep for SECONDS between e-mails sending'),
make_option('--refid',
@@ -276,6 +279,34 @@ def __build_extra_headers():
return headers
+def edit_message(msg):
+ fname = '.stgitmail.txt'
+
+ # create the initial file
+ f = file(fname, 'w')
+ f.write(msg)
+ f.close()
+
+ # the editor
+ if config.has_option('stgit', 'editor'):
+ editor = config.get('stgit', 'editor')
+ elif 'EDITOR' in os.environ:
+ editor = os.environ['EDITOR']
+ else:
+ editor = 'vi'
+ editor += ' %s' % fname
+
+ print 'Invoking the editor: "%s"...' % editor,
+ sys.stdout.flush()
+ print 'done (exit code: %d)' % os.system(editor)
+
+ # read the message back
+ f = file(fname)
+ msg = f.read()
+ f.close()
+
+ return msg
+
def __build_cover(tmpl, total_nr, msg_id, options):
"""Build the cover message (series description) to be sent via SMTP
"""
@@ -326,30 +357,7 @@ def __build_cover(tmpl, total_nr, msg_id
'supported in the patch template'
if options.edit:
- fname = '.stgitmail.txt'
-
- # create the initial file
- f = file(fname, 'w+')
- f.write(msg)
- f.close()
-
- # the editor
- if config.has_option('stgit', 'editor'):
- editor = config.get('stgit', 'editor')
- elif 'EDITOR' in os.environ:
- editor = os.environ['EDITOR']
- else:
- editor = 'vi'
- editor += ' %s' % fname
-
- print 'Invoking the editor: "%s"...' % editor,
- sys.stdout.flush()
- print 'done (exit code: %d)' % os.system(editor)
-
- # read the message back
- f = file(fname)
- msg = f.read()
- f.close()
+ msg = edit_message(msg)
return msg.strip('\n')
@@ -431,6 +439,9 @@ def __build_message(tmpl, patch, patch_n
raise CmdException, 'Only "%(name)s" variables are ' \
'supported in the patch template'
+ if options.edit_patches:
+ msg = edit_message(msg)
+
return msg.strip('\n')
next reply other threads:[~2006-11-01 9:03 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-01 9:00 Karl Hasselström [this message]
2006-11-02 10:32 ` [PATCH] Allow hand-editing of patches before sending Catalin Marinas
2006-11-02 11:36 ` Karl Hasselström
2006-11-03 9:39 ` Catalin Marinas
2006-11-03 9:58 ` Karl Hasselström
2006-11-03 10:01 ` Karl Hasselström
2006-11-03 10:21 ` Petr Baudis
2006-11-03 10:31 ` Robin Rosenberg
2006-11-03 10:36 ` Andreas Ericsson
2006-11-03 10:53 ` Karl Hasselström
2006-11-03 11:21 ` Junio C Hamano
2006-11-03 11:35 ` Karl Hasselström
2006-11-03 12:56 ` Catalin Marinas
2006-11-03 12:07 ` Andy Whitcroft
2006-11-03 12:36 ` Karl Hasselström
2006-11-03 14:03 ` Andy Whitcroft
2006-11-03 18:48 ` Linus Torvalds
2006-11-05 11:43 ` Karl Hasselström
2006-11-05 16:44 ` Linus Torvalds
2006-11-05 19:04 ` Karl Hasselström
2006-11-05 19:29 ` Jakub Narebski
2006-11-06 7:45 ` [PATCH] Add a MIME-Version header to e-mails Karl Hasselström
2006-11-06 7:56 ` Karl Hasselström
2006-11-07 9:53 ` Catalin Marinas
2006-11-07 19:09 ` Catalin Marinas
2006-11-08 8:40 ` Karl Hasselström
2006-11-08 9:41 ` Catalin Marinas
2006-11-08 10:01 ` Karl Hasselström
2006-11-08 10:12 ` Catalin Marinas
2006-11-12 21:14 ` [StGIT PATCH 0/2] mail and import tests Karl Hasselström
2006-11-12 21:15 ` [StGIT PATCH 1/2] Regression test for "stg import" Karl Hasselström
2006-11-12 21:15 ` [StGIT PATCH 2/2] Regression test for "stg mail" Karl Hasselström
2006-11-11 12:24 ` [PATCH] Add a MIME-Version header to e-mails Karl Hasselström
2006-11-16 17:24 ` Catalin Marinas
2006-11-03 12:44 ` [PATCH] Allow hand-editing of patches before sending Catalin Marinas
2006-11-03 13:02 ` Karl Hasselström
2006-11-03 13:16 ` Catalin Marinas
2006-11-03 13:25 ` Karl Hasselström
2006-11-03 13:25 ` Catalin Marinas
2006-11-03 13:33 ` Karl Hasselström
2006-11-03 13:42 ` Karl Hasselström
2006-11-03 13:56 ` Catalin Marinas
2006-11-03 14:37 ` Catalin Marinas
2006-11-03 13:39 ` Petr Baudis
2006-11-03 14:01 ` Catalin Marinas
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=20061101090046.1107.81105.stgit@localhost \
--to=kha@treskal.com \
--cc=catalin.marinas@gmail.com \
--cc=git@vger.kernel.org \
/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).