All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] create-pull-request: Implement -d option
Date: Thu, 30 Jul 2015 14:10:51 +0300	[thread overview]
Message-ID: <1438254651-32545-1-git-send-email-ed.bartosh@linux.intel.com> (raw)

This options allows to generate patches against relative directory by
using git format-patch --relative option.
See more details about --relative option in git diff manual page.

For example generating bitbake patchsets from poky can be
done this way: create-pull-request -u contrib -d ./bitbake

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 scripts/create-pull-request | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/scripts/create-pull-request b/scripts/create-pull-request
index 97ed874..216edfd 100755
--- a/scripts/create-pull-request
+++ b/scripts/create-pull-request
@@ -34,7 +34,7 @@ RFC=0
 usage() {
 CMD=$(basename $0)
 cat <<EOM
-Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to] [-i commit_id] -u remote [-b branch]
+Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to] [-i commit_id] [-d relative_dir] -u remote [-b branch]
   -b branch           Branch name in the specified remote (default: current branch)
   -c                  Create an RFC (Request for Comment) patch series
   -h                  Display this help message
@@ -45,17 +45,19 @@ Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to
   -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
+  -d relative_dir     Generate patches relative to directory
 
  Examples:
    $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
+   $CMD -u contrib -i misc -b nitin/misc -d ./bitbake
 EOM
 }
 
 # Parse and validate arguments
-while getopts "b:chi:m:o:p:r:s:u:" OPT; do
+while getopts "b:cd:hi:m:o:p:r:s:u:" OPT; do
 	case $OPT in
 	b)
 		BRANCH="$OPTARG"
@@ -63,6 +65,9 @@ while getopts "b:chi:m:o:p:r:s:u:" OPT; do
 	c)
 		RFC=1
 		;;
+	d)
+		RELDIR="$OPTARG"
+		;;
 	h)
 		usage
 		exit 0
@@ -170,10 +175,13 @@ if [ -e $ODIR ]; then
 fi
 mkdir $ODIR
 
+if [ -n "$RELDIR" ]; then
+	ODIR=$(realpath $ODIR)
+	extraopts="--relative=$RELDIR"
+fi
 
 # Generate the patches and cover letter
-git format-patch -M40 --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow --cover-letter $RELATIVE_TO..$COMMIT_ID > /dev/null
-
+git format-patch $extraopts -M40 --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow --cover-letter $RELATIVE_TO..$COMMIT_ID > /dev/null
 
 # Customize the cover letter
 CL="$ODIR/0000-cover-letter.patch"
-- 
2.1.4



                 reply	other threads:[~2015-07-30 11:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1438254651-32545-1-git-send-email-ed.bartosh@linux.intel.com \
    --to=ed.bartosh@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 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.