[OE-core] [PATCH] patchtest.sh: optionally specify start branch
Trevor Woerner
twoerner at gmail.com
Tue May 29 13:38:40 UTC 2018
Allow the user to optionally specify a starting branch, otherwise assume
master.
Signed-off-by: Trevor Woerner <twoerner at gmail.com>
---
scripts/contrib/patchtest.sh | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/scripts/contrib/patchtest.sh b/scripts/contrib/patchtest.sh
index 7fe566666e..2a4aea1d28 100755
--- a/scripts/contrib/patchtest.sh
+++ b/scripts/contrib/patchtest.sh
@@ -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)"
--
2.17.0.582.gccdcbd54c
More information about the Openembedded-core
mailing list