All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <seanpaul@chromium.org>
To: intel-gfx@lists.freedesktop.org, ville.syrjala@linux.intel.com
Subject: [PATCH dim 1/2] dim: Add support for multiple messages in extract-tags
Date: Thu, 23 Mar 2017 17:07:27 -0400	[thread overview]
Message-ID: <20170323210731.38313-1-seanpaul@chromium.org> (raw)

Make extract-tags process tags from all messages in the supplied
mbox. This allows the user to tag multiple replies and extract
all tags at once.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 dim | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dim b/dim
index 989674a..43ea794 100755
--- a/dim
+++ b/dim
@@ -342,25 +342,27 @@ if message_id is not None:
 EOF
 }
 
-message_print_body ()
+mbox_cat_messages ()
 {
 	python2 <<EOF
 import email
+import mailbox
 
 def print_part(part):
     mtype = part.get_content_maintype()
     if mtype == 'text':
         print(part.get_payload(decode=True))
 
-def print_msg(file):
-    msg = email.message_from_file(file)
+def print_msg(msg):
     if msg.is_multipart():
         for part in msg.get_payload():
             print_part(part)
     else:
         print_part(msg)
 
-print_msg(open('$1', 'r'))
+mbox = mailbox.mbox('$1', create=False)
+for m in mbox.values():
+    print_msg(m)
 EOF
 }
 
@@ -1157,7 +1159,7 @@ function dim_extract_tags
 
 	cat > $file
 
-	tags=$(message_print_body "$file" | grep -ai '^[^>]*[A-Za-z-]\+: [^ ]')
+	tags=$(mbox_cat_messages "$file" | grep -ai '^[^>]*[A-Za-z-]\+: [^ ]')
 
 	rm -f $file
 
-- 
2.12.1.500.gab5fba24ee-goog

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2017-03-23 21:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23 21:07 Sean Paul [this message]
2017-03-23 21:07 ` [PATCH dim 2/2] dim: Curate and insert tags into patch(es) Sean Paul
2017-03-24  7:54   ` Jani Nikula
2017-03-24 14:04     ` Sean Paul
2017-04-03 21:10     ` [maintainer-tools PATCH v2 " Sean Paul
2017-04-06 11:50       ` Jani Nikula
2017-04-14 16:43         ` [maintainer-tools PATCH v3 " Sean Paul
2017-03-24  9:07   ` [PATCH dim " Ville Syrjälä
2017-03-24 14:09     ` Sean Paul

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=20170323210731.38313-1-seanpaul@chromium.org \
    --to=seanpaul@chromium.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.