From a4c4f5de540fe3396ff1c76155cb5e5e273cf698 Mon Sep 17 00:00:00 2001 From: Yvan Roux Date: Wed, 18 Mar 2015 21:21:25 +0100 Subject: Add a Verification step before branch creation to compare original commit with the ongoing backport. --- backflip | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/backflip b/backflip index ef6b939..265885d 100755 --- a/backflip +++ b/backflip @@ -18,6 +18,7 @@ FNAME=`echo ${NAME} | cut -d ' ' -f 1` EMAIL=`git config user.email` EDITOR="${EDITOR:-vim}" STACKED=false +CMPTOOL="meld" # Arguments while getopts "b:r:v:" options @@ -34,6 +35,7 @@ do done shift $(($OPTIND - 1)) +REV=$1 if [ -z ${DEV_BRANCH+x} ]; then DEV_BRANCH=${REF_BRANCH} fi @@ -62,6 +64,10 @@ die() { exit 1 } +open_shell() { + PROMPT_COMMAND="echo -n -e '${bold}[${red}BackFLiP${NC}${bold}]${NC} '" bash +} + # arg1 : a sentence # arg2 : a variable # print arg1 and gather user input in arg2 @@ -88,6 +94,19 @@ forge_entry() { git add $2.$1.frag } +# arg1 : backported revision sha1 +compare() { + git show $1 > $REV.orig + git diff --cached > $REV.linaro + print_info "Generated diff files: ${bold}$REV.orig $REV.linaro${NC}" + "$CMPTOOL" $REV.orig $REV.linaro + ask "${bold}Do you need a Shell [N/y] ?" user_shell + if [ "$user_shell" == "y" ]; then + open_shell + fi + rm $REV.orig $REV.linaro +} + # ============================================================================== print_step "Checking Configuration" # ============================================================================== @@ -103,12 +122,16 @@ port=29418 project=toolchain/gcc EOF fi +if ! which $CMPTOOL > /dev/null ; then + print_info "Default comparison tool is missing" + ask "Enter tool name: " CMPTOOL +fi print_info "${bold}OK${NC}" # ============================================================================== print_step "Finding SHA1" # ============================================================================== -SHA1=`git log --format=format:"%H" --grep=trunk@${1} master` +SHA1=`git log --format=format:"%H" --grep=trunk@${REV} master` print_info "${NC}SVN rev ${bold}${1}${NC} SHA1: ${bold}${SHA1}${NC}" ask "${bold}View the commit [N/y] ?" user_view if [ "$user_view" == "y" ]; then @@ -140,9 +163,14 @@ print_step "Status Checking" git status ask "${bold}Open a Shell [N/y] ?" user_shell if [ "$user_shell" == "y" ]; then - PROMPT_COMMAND="echo -n -e '${bold}[${red}BackFLiP${NC}${bold}]${NC} '" bash + open_shell fi +# ============================================================================== +print_step "Verification" +# ============================================================================== +compare $SHA1 + # ============================================================================== print_step "Branch/Commit/Push/Review" # ============================================================================== -- cgit v1.2.3