quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH] mail-single-patch.diff


From: Gary V. Vaughan
Subject: [Quilt-dev] [PATCH] mail-single-patch.diff
Date: Sat, 17 Sep 2005 23:03:38 +0100

This patch allows calling quilt mail with a list of patch names
after the usual arguments, and mails only those patches rather
than the entire series.  If only a single patch is named then it
is put into the bady of a single mail (that's what I'm using to
send this patch)

 quilt/mail.in |   41 ++++++++++++++++++++++++++++++++---------
 1 files changed, 32 insertions(+), 9 deletions(-)

Index: quilt-HEAD/quilt/mail.in
===================================================================
--- quilt-HEAD.orig/quilt/mail.in
+++ quilt-HEAD/quilt/mail.in
@@ -26,14 +26,14 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt mail {--mbox file|--send} [--from ...] [--to ...] 
[--cc ...] [--bcc ...] [--subject ...]\n"
+       printf $"Usage: quilt mail {--mbox file|--send} [--from ...] [--to ...] 
[--cc ...] [--bcc ...] [--subject ...] [patch ...]\n"
        if [ x$1 = x-h ]
        then
                printf $"
-Create mail messages from all patches in the series file, and either store
-them in a mailbox file, or send them immediately. The editor is opened
-with a template for the introductory message. Please see the file
-%s for details.
+Create mail messages from all patches in the series file, or the named
+patches (if specified), and either store them in a mailbox file, or send
+them immediately. The editor is opened with a template for the introductory
+ message. Please see the file %s for details.
 
 --mbox file
        Store all messages in the specified file in mbox format. The mbox
@@ -129,7 +129,7 @@ do
        esac
 done
 
-if [ $# -gt 0 -o \( -z "$opt_send" -a -z "$opt_mbox" \) ]
+if [ -z "$opt_send" -a -z "$opt_mbox" ]
 then
        usage
 fi
@@ -154,6 +154,15 @@ if [ "$(type -t quilt_mail_patch_filter
        }
 fi

+# Diagnose any misnamed patches
+for name
+do
+        if ! patch=$(find_patch $name)
+       then
+               printf $"Patch %s is not in series\n" "$name" >&2
+               exit 1
+       fi
+fi
 introduction=$(gen_tempfile)
 (
        cat <<-EOF
@@ -163,17 +172,31 @@ introduction=$(gen_tempfile)
        To: $(IFS=,; echo "${opt_to[*]}")
        Cc: $(IFS=,; echo "${opt_cc[*]}")
        Bcc: $(IFS=,; echo "${opt_bcc[*]}")
-       Subject-Prefix: [patch @num@/@address@hidden
+       EOF
+       if [ $# -ne 1 ]; then
+               echo 'Subject-Prefix: [patch @num@/@address@hidden'
+       fi
+       cat <<-EOF
        Subject: $opt_subject

-       --
        EOF
+       # If there was only one patch specified, it's name will
+       # be in $patch after the misnamed patch check loop above,
+       # and we don't want a separate introduction -- just inline
+       # the patch in the first (and only) message.
+       [ $# -eq 1 ] && cat_file $(patch_file_name $patch) \
+                       | quilt_mail_patch_filter $patch
+       echo "-- "
        [ -r $HOME/.signature ] && cat $HOME/.signature
 ) | @SCRIPTS@/edmail --charset $opt_charset > $introduction

 $EDITOR $introduction || exit 1

-set -- $(cat_series)
+case $# in
+  0) set -- $(cat_series) ;;
+  1) shift ;;
+  *) ;;
+esac
 total=$#

 if [ -n "$opt_mbox" ]; then
--
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook




reply via email to

[Prev in Thread] Current Thread [Next in Thread]