summaryrefslogtreecommitdiffstats
path: root/scripts/create-pull-request
diff options
context:
space:
mode:
authorNitin A Kamble <nitin.a.kamble@intel.com>2010-06-08 22:04:59 -0700
committerSaul Wold <Saul.Wold@intel.com>2010-06-10 16:30:32 -0700
commit1d64687d13ff112c56e1f345a0b4c81a531aed19 (patch)
tree3bbdb1fdff2e6ff4f5c3ccb160c7e66132a4405b /scripts/create-pull-request
parent046ed7e77578085898c4c7f83e56c170c89fed81 (diff)
downloadpoky-1d64687d13ff112c56e1f345a0b4c81a531aed19.tar.gz
update create_pull_request for distro/master
With this change the create_pull_request will be able to generate pull requests to master as well as distro/master branch. Some documentation is added in the Usage messange of the script. Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Diffstat (limited to 'scripts/create-pull-request')
-rwxr-xr-xscripts/create-pull-request77
1 files changed, 61 insertions, 16 deletions
diff --git a/scripts/create-pull-request b/scripts/create-pull-request
index 2223151956..e8d4115e87 100755
--- a/scripts/create-pull-request
+++ b/scripts/create-pull-request
@@ -4,38 +4,83 @@
4# 4#
5 5
6usage() { 6usage() {
7 echo "Error: Invalid arguments."
8 echo "Usage: " 7 echo "Usage: "
9 echo "$ $0 <commit_id> <contrib_branch>" 8 echo "$ $0 [-r <relative_to>] [-i <commit_id>] -b <contrib_branch>"
9 echo " <relative_to> is a commit identifier, like branch-name, HEAD, hex-commit-id"
10 echo " <commit_id> is a commit identifier, like branch-name, HEAD, hex-commit-id" 10 echo " <commit_id> is a commit identifier, like branch-name, HEAD, hex-commit-id"
11 echo " <contrib_branch> is the branch-name in the git.pokylinux.org/poky-contrib tree" 11 echo " <contrib_branch> is the branch-name in the git.pokylinux.org/poky-contrib tree"
12 echo " If <relative_to> is not specified then relative to master is assumed"
13 echo " If <commit_id> is not specified then it is assumed as HEAD"
14 echo " For Example:"
15 echo " $0 -r master -i misc -b nitin/misc "
16 echo " $0 -b nitin/misc "
17 echo " $0 -r distro/master -i nitin/distro -b nitin/distro "
12 exit 1 18 exit 1
13} 19}
14 20
15case $# in 21while [ $# -ne 0 ] # loop over arguments
16 2) 22do
17 COMMIT=$1 23
18 CONTRIB_BRANCH=$2 24 case $1 in
19 shift 25 -r )
20 ;; 26 shift
27 RELATIVE_TO=$1
28 shift
29 ;;
30 -i )
31 shift
32 COMMIT_ID=$1
33 shift
34 ;;
35 -b )
36 shift
37 CONTRIB_BRANCH=$1
38 shift
39 ;;
21 *) 40 *)
41 usage
42 ;;
43 esac
44done
45
46if [ "${COMMIT_ID}" = "" ]; then
47 COMMIT_ID=HEAD
48 echo "Note: <commit_id> parameter assumed as 'HEAD'"
49fi
50
51if [ "${RELATIVE_TO}" = "" ]; then
52 RELATIVE_TO=master
53 echo "Note: <relative_to> parameter assumed as 'master'"
54fi
55
56if [ "${CONTRIB_BRANCH}" = "" ]; then
57 echo: "Error: Parameter <contrib_branch> not specified"
22 usage 58 usage
23 ;; 59fi
24esac
25 60
26if [ "$COMMIT" = "" ]; then 61git --no-pager show ${COMMIT_ID} > /dev/null
62if [ "$?" != "0" ]; then
63 echo "Error: Invalid <commit_id> parameter specified"
27 usage 64 usage
28fi 65fi
29 66
30git --no-pager show $COMMIT > /dev/null 67git --no-pager show ${RELATIVE_TO} > /dev/null
31if [ "$?" != "0" ]; then 68if [ "$?" != "0" ]; then
32 echo "Invalid Commit." 69 echo "Error: Invalid <relative_to> parameter specified: ${RELATIVE_TO}"
33 usage 70 usage
34fi 71fi
35 72
36git --no-pager diff master..${COMMIT} | diffstat -p1
37echo "" 73echo ""
38git --no-pager log --no-merges master..${COMMIT} | git --no-pager shortlog 74git --no-pager diff ${RELATIVE_TO}..${COMMIT_ID} | diffstat -p1
75echo ""
76git --no-pager log --no-merges ${RELATIVE_TO}..${COMMIT_ID} | git --no-pager shortlog
39 77
78PULL_URL="http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=${CONTRIB_BRANCH}"
40 79
41echo "Pull URL: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=${CONTRIB_BRANCH}" 80echo "Pull URL: ${PULL_URL}"
81
82wget -q ${PULL_URL} -O - | grep -q "Invalid branch:\ ${CONTRIB_BRANCH}"
83if [ "$?" == "0" ]; then
84 echo "Warning: Branch named '${CONTRIB_BRANCH}' was not found on contrib git tree"
85 echo "Check your <contrib-branch> parameter"
86fi