Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@linux.intel.com>
To: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [RFC PATCH 03/10] create-pull-request: use git request-pull and arbitrary remotes
Date: Fri, 13 May 2011 19:04:50 -0700	[thread overview]
Message-ID: <4DCDE342.2080403@linux.intel.com> (raw)
In-Reply-To: <1305332074.2023.62.camel@scimitar>



On 05/13/2011 05:14 PM, Joshua Lock wrote:
> On Fri, 2011-05-13 at 16:37 -0700, Darren Hart wrote:
>> Allow for arbitrary remotes via a new -u argument. Remove the hard coded
>> references to the pokylinux repositories. Create the WEB_URL from known
>> remotes. Future patches can add additional WEB_URL mappings for remotes
>> like Git Hub, Gitorious, and kernel.org.
>>
>> Rather than duplicating the git request-pull command ourselves, just use
>> the existing one.
>>
>> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
>> Cc: Tom Rini <tom_rini@mentor.com>
>> Cc: Martin Jansa <martin.jansa@gmail.com>
>> Cc: Otavio Salvador <otavio@ossystems.com.br>
>> Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
>> ---
>>  scripts/create-pull-request |   74 ++++++++++++++++++++++++++++--------------
>>  1 files changed, 49 insertions(+), 25 deletions(-)
>>
>> diff --git a/scripts/create-pull-request b/scripts/create-pull-request
>> index b7e015a..c6cf817 100755
>> --- a/scripts/create-pull-request
>> +++ b/scripts/create-pull-request
>> @@ -2,14 +2,13 @@
>>  ODIR=pull-$$
>>  RELATIVE_TO="master"
>>  COMMIT_ID="HEAD"
>> -PULL_URL="git://git.pokylinux.org/poky-contrib.git"
>>  PREFIX="PATCH"
>>  
>>  usage() {
>>  CMD=$(basename $0)
>>  cat <<EOM
>> -Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to] [-i commit_id] -b contrib_branch
>> -  -b contrib_branch   Branch-name in the git.pokylinux.org/poky-contrib tree
>> +Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to] [-i commit_id] -u remote -b branch
>> +  -b branch           Branch name in the specified remote
>>    -h                  Display this help message
>>    -i commit_id        Ending commit (default: HEAD)
>>    -m msg_body_file    The file containing a blurb to be inserted into the summary email
>> @@ -17,20 +16,21 @@ Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to
>>    -p prefix           Use [prefix N/M] instead of [PATCH N/M] as the subject prefix
>>    -r relative_to      Starting commit (default: master)
>>    -s subject          The subject to be inserted into the summary email
>> +  -u remote           The git remote where the branch is located
>>  
>>   Examples:
>> -   $CMD -b nitin/basic
>> -   $CMD -r distro/master -i nitin/distro -b nitin/distro
>> -   $CMD -r master -i misc -b nitin/misc -o pull-misc
>> -   $CMD -p "RFC PATCH" -b nitin/experimental
>> +   $CMD -u contrib -b nitin/basic
>> +   $CMD -u contrib -r distro/master -i nitin/distro -b nitin/distro
>> +   $CMD -u contrib -r master -i misc -b nitin/misc -o pull-misc
>> +   $CMD -u contrib -p "RFC PATCH" -b nitin/experimental
>>  EOM
>>  }
>>  
>>  # Parse and validate arguments
>> -while getopts "b:hi:m:o:p:r:s:" OPT; do
>> +while getopts "b:hi:m:o:p:r:s:u:" OPT; do
>>  	case $OPT in
>>  	b)
>> -		CONTRIB_BRANCH="$OPTARG"
>> +		BRANCH="$OPTARG"
>>  		;;
>>  	h)
>>  		usage
>> @@ -58,23 +58,42 @@ while getopts "b:hi:m:o:p:r:s:" OPT; do
>>  	s)
>>  		SUBJECT="$OPTARG"
>>  		;;
>> +	u)
>> +		REMOTE="$OPTARG"
>> +		REMOTE_URL=$(git config remote.$REMOTE.url)
>> +		if [ $? -ne 0 ]; then
>> +			echo "ERROR: git config failed to find a url for '$REMOTE'"
>> +			exit 1
>> +		fi
>> +		;;
>>  	esac
>>  done
>>  
>> -if [ -z "$CONTRIB_BRANCH" ]; then
>> +if [ -z "$BRANCH" ] || [ -z "$REMOTE_URL" ]; then
>>  	usage
>>  	exit 1
>>  fi
>>  
>>
>> +# Set WEB_URL from known remotes
>> +case "$REMOTE_URL" in
>> +	*git.yoctoproject.org*)
>> +		WEB_URL="http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=$BRANCH"
>> +		;;
>> +	*git.pokylinux.org*)
>> +		WEB_URL="http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=$BRANCH"
>> +		;;
>> +esac
> 
> Nit: what about if this is a remote branch on that server but not for
> that repo?

Doh, that isn't a nit, that's a bug. Thanks for catching it!

--
Darren

> 
>> +
>>  # Perform a sanity test on the web URL. Issue a warning if it is not
>>  # accessible, but do not abort as users may want to run offline.
>> -WEB_URL="http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=$CONTRIB_BRANCH"
>> -wget -q $WEB_URL -O /dev/null
>> -if [ $? -ne 0 ]; then
>> -	echo "WARNING: Branch '$CONTRIB_BRANCH' was not found on the contrib git tree."
>> -	echo "         Please check your contrib-branch parameter before sending."
>> -	echo ""
>> +if [ -n "$WEB_URL" ]; then
>> +	wget -q $WEB_URL -O /dev/null
>> +	if [ $? -ne 0 ]; then
>> +		echo "WARNING: Branch '$BRANCH' was not found on the contrib git tree."
>> +		echo "         Please check your remote and branch parameter before sending."
>> +		echo ""
>> +	fi
>>  fi
>>  
>>  if [ -e $ODIR ]; then
>> @@ -90,18 +109,23 @@ git format-patch -M --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow --co
>>  
>>  # Customize the cover letter
>>  CL="$ODIR/0000-cover-letter.patch"
>> -(cat <<EOM
>> +PM="$ODIR/pull-msg"
>> +git request-pull $RELATIVE_TO $REMOTE_URL $COMMIT_ID > "$PM"
>> +if [ $? -ne 0 ]; then
>> +	echo "ERROR: git request-pull reported an error"
>> +	exit 1
>> +fi
>>  
>> -Pull URL: $PULL_URL
>> -  Branch: $CONTRIB_BRANCH
>> -  Browse: $WEB_URL
>> +# The cover letter already has a diffstat, remove it from the pull-msg
>> +# before inserting it.
>> +sed -n "0,\#$REMOTE_URL# p" "$PM" | sed -i "/BLURB HERE/ r /dev/stdin" "$CL"
>> +rm "$PM"
>>  
>> -Thanks,
>> -    $(git config user.name) <$(git config user.email)>
>> ----
>> +# Insert the WEB_URL if there is one
>> +if [ -n "$WEB_URL" ]; then
>> +	echo "  $WEB_URL" | sed -i "\#$REMOTE_URL# r /dev/stdin" "$CL"
>> +fi
>>  
>> -EOM
>> -) | sed -i "/BLURB HERE/ r /dev/stdin" "$CL"
>>  
>>  # If the user specified a message body, insert it into the cover letter and
>>  # remove the BLURB token.
> 

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



  reply	other threads:[~2011-05-14  2:07 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13 23:35 [RFC PATCH 00/10] *-pull-request: cleanup and overhaul Darren Hart
2011-05-13 23:36 ` [RFC PATCH 01/10] create-pull-request: alphabetize arguments Darren Hart
2011-05-13 23:36 ` [RFC PATCH 02/10] create-pull-request: whitespace cleanup Darren Hart
2011-05-13 23:37 ` [RFC PATCH 03/10] create-pull-request: use git request-pull and arbitrary remotes Darren Hart
2011-05-14  0:14   ` Joshua Lock
2011-05-14  2:04     ` Darren Hart [this message]
2011-05-14  3:19     ` Darren Hart
2011-05-16 16:31       ` Joshua Lock
2011-05-13 23:37 ` [RFC PATCH 04/10] create-pull-request: rewrite known private URLs to public URLs Darren Hart
2011-05-13 23:37 ` [RFC PATCH 05/10] create-pull-request: provide an RFC mode via -c argument Darren Hart
2011-05-13 23:37 ` [RFC PATCH 06/10] send-pull-request: whitespace cleanup Darren Hart
2011-05-13 23:38 ` [RFC PATCH 07/10] send-pull-request: remove local mta support Darren Hart
2011-05-13 23:38 ` [RFC PATCH 08/10] send-pull-request: fix greedy auto-cc regex Darren Hart
2011-05-14  5:41   ` Bruce Ashfield
2011-05-13 23:38 ` [RFC PATCH 09/10] send-pull-request: don't send all patches to everyone even with -a Darren Hart
2011-05-13 23:44   ` Khem Raj
2011-05-14  0:14     ` Joshua Lock
2011-05-14  0:31     ` Darren Hart
2011-05-13 23:38 ` [RFC PATCH 10/10] send-pull-request: verify git sendemail config Darren Hart
2011-05-14  5:43   ` Bruce Ashfield
2011-05-14 18:45     ` Darren Hart
2011-05-15  2:48       ` Bruce Ashfield
2011-05-16 15:13         ` Darren Hart
2011-05-16 15:16           ` Bruce Ashfield
2011-05-14  3:47 ` [RFC PATCH 00/10] *-pull-request: cleanup and overhaul Darren Hart

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=4DCDE342.2080403@linux.intel.com \
    --to=dvhart@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.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