summaryrefslogtreecommitdiffstats
path: root/scripts/create-pull-request
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-07-30 14:10:51 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-01 07:34:06 +0100
commit90bc2f35d0643a0be8570a6f6e85b3c20a2512be (patch)
tree0cd36934d45e97d53de47dded8769ef197da032e /scripts/create-pull-request
parent363bec05e6e5c2be2d8d7ea23e48fee2a1ce14ad (diff)
downloadpoky-90bc2f35d0643a0be8570a6f6e85b3c20a2512be.tar.gz
create-pull-request: Implement -d option
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 (From OE-Core rev: 9b544125e1e3d2cc2db8f5d20d6fd0746f8cef5d) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/create-pull-request')
-rwxr-xr-xscripts/create-pull-request16
1 files changed, 12 insertions, 4 deletions
diff --git a/scripts/create-pull-request b/scripts/create-pull-request
index 97ed874e7f..216edfd751 100755
--- a/scripts/create-pull-request
+++ b/scripts/create-pull-request
@@ -34,7 +34,7 @@ RFC=0
34usage() { 34usage() {
35CMD=$(basename $0) 35CMD=$(basename $0)
36cat <<EOM 36cat <<EOM
37Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to] [-i commit_id] -u remote [-b branch] 37Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to] [-i commit_id] [-d relative_dir] -u remote [-b branch]
38 -b branch Branch name in the specified remote (default: current branch) 38 -b branch Branch name in the specified remote (default: current branch)
39 -c Create an RFC (Request for Comment) patch series 39 -c Create an RFC (Request for Comment) patch series
40 -h Display this help message 40 -h Display this help message
@@ -45,17 +45,19 @@ Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to
45 -r relative_to Starting commit (default: master) 45 -r relative_to Starting commit (default: master)
46 -s subject The subject to be inserted into the summary email 46 -s subject The subject to be inserted into the summary email
47 -u remote The git remote where the branch is located 47 -u remote The git remote where the branch is located
48 -d relative_dir Generate patches relative to directory
48 49
49 Examples: 50 Examples:
50 $CMD -u contrib -b nitin/basic 51 $CMD -u contrib -b nitin/basic
51 $CMD -u contrib -r distro/master -i nitin/distro -b nitin/distro 52 $CMD -u contrib -r distro/master -i nitin/distro -b nitin/distro
52 $CMD -u contrib -r master -i misc -b nitin/misc -o pull-misc 53 $CMD -u contrib -r master -i misc -b nitin/misc -o pull-misc
53 $CMD -u contrib -p "RFC PATCH" -b nitin/experimental 54 $CMD -u contrib -p "RFC PATCH" -b nitin/experimental
55 $CMD -u contrib -i misc -b nitin/misc -d ./bitbake
54EOM 56EOM
55} 57}
56 58
57# Parse and validate arguments 59# Parse and validate arguments
58while getopts "b:chi:m:o:p:r:s:u:" OPT; do 60while getopts "b:cd:hi:m:o:p:r:s:u:" OPT; do
59 case $OPT in 61 case $OPT in
60 b) 62 b)
61 BRANCH="$OPTARG" 63 BRANCH="$OPTARG"
@@ -63,6 +65,9 @@ while getopts "b:chi:m:o:p:r:s:u:" OPT; do
63 c) 65 c)
64 RFC=1 66 RFC=1
65 ;; 67 ;;
68 d)
69 RELDIR="$OPTARG"
70 ;;
66 h) 71 h)
67 usage 72 usage
68 exit 0 73 exit 0
@@ -170,10 +175,13 @@ if [ -e $ODIR ]; then
170fi 175fi
171mkdir $ODIR 176mkdir $ODIR
172 177
178if [ -n "$RELDIR" ]; then
179 ODIR=$(realpath $ODIR)
180 extraopts="--relative=$RELDIR"
181fi
173 182
174# Generate the patches and cover letter 183# Generate the patches and cover letter
175git format-patch -M40 --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow --cover-letter $RELATIVE_TO..$COMMIT_ID > /dev/null 184git format-patch $extraopts -M40 --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow --cover-letter $RELATIVE_TO..$COMMIT_ID > /dev/null
176
177 185
178# Customize the cover letter 186# Customize the cover letter
179CL="$ODIR/0000-cover-letter.patch" 187CL="$ODIR/0000-cover-letter.patch"