patchtest.sh: optionally specify start branch
PATCH 1/1 patchtest.sh: optionally specify start branch
Allow the user to optionally specify a starting branch, otherwise assume master.
Signed-off-by Trevor Woerner <[email protected]>
--- scripts/contrib/patchtest.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
scripts/contrib/patchtest.sh +14 -5
@@ -2,7 +2,7 @@ # ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- # -# patchtest: Run patchtest on commits starting at master +# patchtest: Run patchtest on commits starting at specified branch, or master # # Copyright (c) 2017, Intel Corporation. # All rights reserved.
@@ -29,8 +29,9 @@ pokydir='' usage() { CMD=$(basename $0) cat <<EOM -Usage: $CMD [-h] [-p pokydir] - -p pokydir Defaults to current directory +Usage: $CMD [-h] [-p pokydir] [-b startbranch] + -p pokydir Defaults to current directory + -b startbranch Defaults to master EOM >&2 exit 1
@@ -46,11 +47,14 @@ function clone() { fi } -while getopts ":p:h" opt; do +while getopts ":p:hb:" opt; do case $opt in p) pokydir=$OPTARG ;; + b) + branch=$OPTARG + ;; h) usage ;;
@@ -73,6 +77,11 @@ if [ -z "$pokydir" ]; then pokydir="$CDIR" fi +# default branch to master if the user did not specify otherwise +if [ -z "$branch" ]; then + branch="master" +fi + PTENV="$PWD/patchtest" PT="$PTENV/patchtest" PTOE="$PTENV/patchtest-oe"
@@ -99,7 +108,7 @@ pip install -r $PTOE/requirements.txt --quiet PATH="$PT:$PT/scripts:$PATH" # loop through parent to HEAD and execute patchtest on each commit -for commit in $(git rev-list master..HEAD --reverse) +for commit in $(git rev-list ${branch}..HEAD --reverse) do shortlog="$(git log "$commit^1..$commit" --pretty='%h: %aN: %cd: %s')" log="$(git format-patch "$commit^1..$commit" --stdout | patchtest - -r $pokydir -s $PTOE/tests --base-commit $commit^1 --json 2>/dev/null | create-summary --fail --only-results)"
Signature · 1 line
2.17.0.582.gccdcbd54c
ping?
Quoted 77 lines · Trevor Woerner
Allow the user to optionally specify a starting branch, otherwise assume master.
Signed-off-by Trevor Woerner <[email protected]>--- scripts/contrib/patchtest.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)scripts/contrib/patchtest.sh +1
-1@@ -2,7 +2,7 @@ # ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- # -# patchtest: Run patchtest on commits starting at master +# patchtest: Run patchtest on commits starting at specified branch, ormaster
#
# Copyright (c) 2017, Intel Corporation.
# All rights reserved.scripts/contrib/patchtest.sh +13
-5@@ -29,8 +29,9 @@ pokydir='' usage() { CMD=$(basename $0) cat <<EOM -Usage: $CMD [-h] [-p pokydir] - -p pokydir Defaults to current directory +Usage: $CMD [-h] [-p pokydir] [-b startbranch] + -p pokydir Defaults to current directory + -b startbranch Defaults to master EOM >&2 exit 1@@ -46,11 +47,14 @@ function clone() { fi } -while getopts ":p:h" opt; do +while getopts ":p:hb:" opt; do case $opt in p) pokydir=$OPTARG ;; + b) + branch=$OPTARG + ;; h) usage ;;@@ -73,6 +77,11 @@ if [ -z "$pokydir" ]; then pokydir="$CDIR" fi +# default branch to master if the user did not specify otherwise +if [ -z "$branch" ]; then + branch="master" +fi + PTENV="$PWD/patchtest" PT="$PTENV/patchtest" PTOE="$PTENV/patchtest-oe"@@ -99,7 +108,7 @@ pip install -r $PTOE/requirements.txt --quiet PATH="$PT:$PT/scripts:$PATH" # loop through parent to HEAD and execute patchtest on each commit -for commit in $(git rev-list master..HEAD --reverse) +for commit in $(git rev-list ${branch}..HEAD --reverse) do shortlog="$(git log "$commit^1..$commit" --pretty='%h: %aN: %cd: %s')" log="$(git format-patch "$commit^1..$commit" --stdout | patchtest - -r $pokydir -s $PTOE/tests --base-commit $commit^1 --json 2>/dev/null |create-summary --fail --only-results)"
--
2.17.0.582.gccdcbd54c