All of lore.kernel.org
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@linux.intel.com>
To: Khem Raj <raj.khem@gmail.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [RFC PATCH v2 14/15] send-pull-request: streamline git-send-email usage
Date: Tue, 17 May 2011 10:38:09 -0700	[thread overview]
Message-ID: <4DD2B281.6000300@linux.intel.com> (raw)
In-Reply-To: <BANLkTinDQ5rsDKuaXcyYxPnCoGnMNQ+7=Q@mail.gmail.com>



On 05/17/2011 10:05 AM, Khem Raj wrote:
> On Mon, May 16, 2011 at 3:26 PM, Darren Hart <dvhart@linux.intel.com> wrote:
>> The script was sending one patch at a time, which defeats the internal
>> confirmation mechanism of git-send-email (which would otherwise allow
>> the user to send all patches or abort immediately).
>>
>> Rework the sending logic to use no more than two commands. Use two
>> commands when the cover letter is to be sent to all recipients with
>> the -a argument. Otherwise, send all patches via the same command.
>>
>> The script duplicates git's send confirmation, eliminate that.
>>
>> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
>> Reported-by: Khem Raj <raj.khem@gmail.com>
>> Cc: Khem Raj <raj.khem@gmail.com>
>> Cc: Joshua Lock <josh@linux.intel.com>
>> ---
>>  scripts/send-pull-request |   68 +++++++++++++++++---------------------------
>>  1 files changed, 26 insertions(+), 42 deletions(-)
>>
>> diff --git a/scripts/send-pull-request b/scripts/send-pull-request
>> index 21eb302..8d0bd34 100755
>> --- a/scripts/send-pull-request
>> +++ b/scripts/send-pull-request
>> @@ -1,6 +1,7 @@
>>  #!/bin/bash
>>  AUTO=0
>>  AUTO_CL=0
>> +GITSOBCC=""
>>
>>  # Prevent environment leakage to these vars.
>>  unset TO
>> @@ -59,10 +60,11 @@ while getopts "achp:t:" OPT; do
>>        case $OPT in
>>        a)
>>                AUTO_CL=1
>> -               AUTO=1
>> -               ;;
>> +               # Fall through to include -c
>> +               ;&
>>        c)
>>                AUTO=1
>> +               GITSOBCC="--signed-off-by-cc"
>>                ;;
>>        h)
>>                usage
>> @@ -130,48 +132,30 @@ if [ -z "$TO" ] && [ -z "$AUTO_CC" ]; then
>>  fi
>>
>>
>> -# Generate report for the user and require confirmation before sending
>> -cat <<EOM
>> -The following patches:
>> -$(for PATCH in $PDIR/*.patch; do echo "    $PATCH"; done)
>> +# Convert the collected addresses into git-send-email argument strings
>> +export IFS=$','
>> +GIT_TO=$(for R in $TO; do echo -n "--to='$R' "; done)
>> +GIT_CC=$(for R in $AUTO_CC; do echo -n "--cc='$R' "; done)
>> +unset IFS
>>
>> -will now be sent via the git send-email command. Git will prompt you before
>> -sending any email.
>>
>> -EOM
>> -echo "Continue? [y/N] "
>> -read cont
>> -
>> -if [ "$cont" == "y" ] || [ "$cont" == "Y" ]; then
>> -       ERROR=0
>> -       export IFS=$','
>> -       GIT_TO=$(for R in $TO; do echo -n "--to='$R' "; done)
>> -       GIT_CC=$(for R in $AUTO_CC; do echo -n "--cc='$R' "; done)
>> -       unset IFS
>> -       for PATCH in $PDIR/*patch; do
>> -               if [ $AUTO -eq 1 ]; then
>> -                       if [ $PATCH == "$CL" ] && [ $AUTO_CL -eq 1 ]; then
>> -                               # Send the cover letter to every recipient, both
>> -                               # specified as well as harvested.
>> -                               eval "git send-email $GIT_TO $GIT_CC --confirm=always --no-chain-reply-to --suppress-cc=all $PATCH"
>> -                       else
>> -                               # Send the patch to the specified recipients and
>> -                               # those git finds in this specific patch.
>> -                               eval "git send-email $GIT_TO --confirm=always --no-chain-reply-to --signed-off-by-cc $PATCH"
>> -                       fi
>> -               else
>> -                       # Only send to the explicitly specified recipients
>> -                       eval "git send-email $GIT_TO --confirm=always --no-chain-reply-to --suppress-cc=all $PATCH"
>> -               fi
>> -               if [ $? -eq 1 ]; then
>> -                       ERROR=1
>> -               fi
>> -       done
>> -
>> -       if [ $ERROR -eq 1 ]; then
>> -               echo "ERROR: Failed to send one or more messages."
>> +# Handoff to git-send-email. It will perform the send confirmation.
>> +PATCHES=$(echo $PDIR/*.patch)
>> +if [ $AUTO_CL -eq 1 ]; then
>> +       # Send the cover letter to every recipient, both specified as well as
>> +       # harvested. Then remove it from the patches list.
>> +       eval "git send-email $GIT_TO $GIT_CC --confirm=always --no-chain-reply-to --suppress-cc=all $CL"
>> +       if [ $? -eq 1 ]; then
>> +               echo "ERROR: failed to send cover-letter with automatic recipients."
>> +               exit 1
>>        fi
>> -else
>> -       echo "Send aborted."
>> +       PATCHES=${PATCHES/"$CL"/}
>>  fi
>>
>> +# Send the patch to the specified recipients and, if -c was specified, those git
>> +# finds in this specific patch.
>> +eval "git send-email $GIT_TO --confirm=always --no-chain-reply-to $GITSOBCC $PATCHES"
>> +if [ $? -eq 1 ]; then
>> +       echo "ERROR: failed to send patches."
>> +       exit 1
>> +fi
> 
> 
> now it will ask the usual git confirmation once for all the patches
> are now mentioned on the commandline instead of a loop.
> So I can say 'a'  all in the confirmation and then it will take that
> to send all patches. Is my understanding right ?
> 
> If so then it seems ok to me

That is the case if -a is not used. If -a is used, then you will get a
git confirmation for the cover letter and another for the rest of the
series, which you can say 'a' to and send all of them. This is because
-a uses a different recipients list for the cover-letter than the rest
of the patches.

This also allows for a dry-run by:

yes "n" | send-pull-request ...


> 
>> --
>> 1.7.1
>>
>>

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel



  reply	other threads:[~2011-05-17 17:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-16 22:25 [RFC PATCH v2 00/15] *-pull-request: cleanup and overhaul Darren Hart
2011-05-16 22:26 ` [RFC PATCH v2 01/15] create-pull-request: alphabetize arguments Darren Hart
2011-05-16 22:26 ` [RFC PATCH v2 02/15] create-pull-request: whitespace cleanup Darren Hart
2011-05-16 22:26 ` [RFC PATCH v2 03/15] create-pull-request: use git request-pull and arbitrary remotes Darren Hart
2011-05-16 22:26 ` [RFC PATCH v2 04/15] create-pull-request: rewrite known private URLs to public URLs Darren Hart
2011-05-16 23:40   ` Joshua Lock
2011-05-16 22:26 ` [RFC PATCH v2 05/15] create-pull-request: provide an RFC mode via -c argument Darren Hart
2011-05-16 23:40   ` Joshua Lock
2011-05-16 22:26 ` [RFC PATCH v2 06/15] send-pull-request: whitespace cleanup Darren Hart
2011-05-16 22:26 ` [RFC PATCH v2 07/15] send-pull-request: remove local mta support Darren Hart
2011-05-16 22:26 ` [RFC PATCH v2 08/15] send-pull-request: fix greedy auto-cc regex Darren Hart
2011-05-16 22:26 ` [RFC PATCH v2 09/15] send-pull-request: don't send all patches to everyone even with -a Darren Hart
2011-05-16 22:26 ` [RFC PATCH v2 10/15] send-pull-request: verify git sendemail config Darren Hart
2011-05-16 22:26 ` [RFC PATCH v2 11/15] create-pull-request: do not check certificate Darren Hart
2011-05-16 22:26 ` [RFC PATCH v2 12/15] create-pull-request: add GitHub remote support Darren Hart
2011-05-16 22:26 ` [RFC PATCH v2 13/15] create-pull-request: add untested oe repository support Darren Hart
2011-05-16 22:26 ` [RFC PATCH v2 14/15] send-pull-request: streamline git-send-email usage Darren Hart
2011-05-16 23:40   ` Joshua Lock
2011-05-17 17:05   ` Khem Raj
2011-05-17 17:38     ` Darren Hart [this message]
2011-05-16 22:26 ` [RFC PATCH v2 15/15] *pull-request: add copyright, license, and descriptions Darren Hart
2011-05-17 14:02 ` [RFC PATCH v2 00/15] *-pull-request: cleanup and overhaul Otavio Salvador
2011-05-17 19:02 ` Tom Rini
2011-05-20  0:46 ` Saul Wold

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=4DD2B281.6000300@linux.intel.com \
    --to=dvhart@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=raj.khem@gmail.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.