[tools] master update

tomas at openssl.org tomas at openssl.org
Mon Nov 1 13:09:22 UTC 2021


The branch master has been updated
       via  4a5441d5602435cd801aeee4add5908cfc86acab (commit)
       via  522710ebddbc2b17ad949174c3b30900be36e79c (commit)
       via  fb3ea4fea8a625bbf36516d0e329bf4790a12641 (commit)
       via  f6ecc7fef076779d1dde76fc6c7e4719aa685cb6 (commit)
       via  b92201c5a37ae8ef57298899464fc6c9eac0e70a (commit)
       via  e2c1ff33aaa776b465f23989107e2a72d3d2804f (commit)
      from  3189d5753970fa290365b02acb535ea5ef09e995 (commit)


- Log -----------------------------------------------------------------
commit 4a5441d5602435cd801aeee4add5908cfc86acab
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Mon Oct 25 10:01:19 2021 +0200

    pick-to-branch: Further improve user guidance on commit id
    
    Reviewed-by: Paul Dale <pauli at openssl.org>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/tools/pull/95)

commit 522710ebddbc2b17ad949174c3b30900be36e79c
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Mon Oct 25 09:47:18 2021 +0200

    pick-to-branch: Fix behavior on failed cherry-pick
    
    Reviewed-by: Paul Dale <pauli at openssl.org>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/tools/pull/95)

commit fb3ea4fea8a625bbf36516d0e329bf4790a12641
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Mon Oct 25 09:36:51 2021 +0200

    pick-to-branch: Improve diagnostics on bad target branch
    
    Reviewed-by: Paul Dale <pauli at openssl.org>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/tools/pull/95)

commit f6ecc7fef076779d1dde76fc6c7e4719aa685cb6
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Sat Oct 23 13:10:41 2021 +0200

    pick-to-branch: Fix the case that commit id is derived from HEAD of master
    
    Reviewed-by: Paul Dale <pauli at openssl.org>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/tools/pull/95)

commit b92201c5a37ae8ef57298899464fc6c9eac0e70a
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Sat Oct 23 12:49:30 2021 +0200

    pick-to-branch: Preserve current branch and its state if it is not the target
    
    Reviewed-by: Paul Dale <pauli at openssl.org>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/tools/pull/95)

commit e2c1ff33aaa776b465f23989107e2a72d3d2804f
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Sat Oct 23 12:32:35 2021 +0200

    pick-to-branch: Improve user guidance
    
    Reviewed-by: Paul Dale <pauli at openssl.org>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/tools/pull/95)

-----------------------------------------------------------------------

Summary of changes:
 review-tools/pick-to-branch | 61 ++++++++++++++++++++++++++++++++++-----------
 1 file changed, 47 insertions(+), 14 deletions(-)

diff --git a/review-tools/pick-to-branch b/review-tools/pick-to-branch
index c446763..6513a36 100755
--- a/review-tools/pick-to-branch
+++ b/review-tools/pick-to-branch
@@ -1,6 +1,15 @@
 #! /bin/bash
 
-# If one arg, intuit commit id from master
+function usage {
+    echo "Usage: pick-to-branch [<id>] <branch>
+    Cherry-pick a commit on the given release target branch.
+    If this is not the current branch, the current branch and its state are preserved.
+
+    The commit can be given in the form of a branch name.
+    If no <id> arg is given, intuit commit id from master.
+    The <branch> arg must match a release branch or start with 'm' for master.
+    A release branch may be given simply as 102, 110, 111, 30, 31."
+}
 
 case $# in
 2)
@@ -8,11 +17,11 @@ case $# in
     b=$2
     ;;
 1)
-    id=`git branch -v | awk '$2=="master" { print $3; }'`
+    id=`git branch -v | awk '$1=="master" { print $2; }'`
     b=$1
     ;;
 *)
-    echo "Usage $0 [commitid] branch"
+    usage
     exit 1
     ;;
 esac
@@ -31,22 +40,27 @@ case $b in
 *3*0*)
     branch=openssl-3.0
     ;;
+*3*1*)
+    branch=openssl-3.1
+    ;;
 m*)
     branch=master
     ;;
 *)
-    echo Unknown branch
+    echo Unknown release target branch \'$b\'
     exit 1
     ;;
 esac
 
-echo "id is $id"
-echo "branch is $branch"
-echo "Are these correct?"
+echo "Commit to chery-pick is:"
+git show $id | head -n 5
+echo
+echo "Target branch is: $branch"
+echo "Are both of these correct?"
 
 while true
 do
-    echo -n "Enter 'yes' to continue or 'no' to abort: "
+    echo -n "Enter 'y'/'yes' to continue or 'n'/'no' to abort: "
     read x
     x="`echo $x | tr A-Z a-z`"
     if [ "$x" = "y" -o "$x" = "yes" -o "$x" = "n" -o "$x" = "no" ]
@@ -60,13 +74,34 @@ then
     exit 1
 fi
 
-git checkout --quiet master || exit 1
-git checkout $branch || exit 1
-git cherry-pick -e -x $id
+
+ORIG_REF=`git rev-parse --abbrev-ref HEAD` # usually this will be 'master'
+if [ "$branch" != "$ORIG_REF" ]; then
+    STASH_OUT=`git stash`
+fi
+
+function cleanup {
+    rv=$?
+    echo # make sure to enter new line, needed, e.g., after Ctrl-C
+    [ $rv -ne 0 ] && echo -e "pick-to-branch failed"
+    if [ "$branch" != "$ORIG_REF" ]; then
+        echo Returning to previous branch $ORIG_REF
+        git checkout -q $ORIG_REF
+        if [ "$STASH_OUT" != "No local changes to save" ]; then
+            git stash pop -q # restore original state, pruning any leftover commits added locally
+        fi
+    fi
+}
+set -o errexit
+trap 'cleanup' EXIT
+
+git checkout --quiet master
+git checkout $branch
+git cherry-pick -e -x $id || (git cherry-pick --abort; exit 1)
 
 while true
 do
-    echo -n "Enter 'yes' to push or 'no' to abort: "
+    echo -n "Enter 'y'/'yes' to push or 'n'/'no' to abort: "
     read x
     x="`echo $x | tr A-Z a-z`"
     if [ "$x" = "y" -o "$x" = "yes" -o "$x" = "n" -o "$x" = "no" ]
@@ -79,5 +114,3 @@ if [ "$x" = "y" -o "$x" = "yes" ]
 then
     git push
 fi
-
-git checkout master


More information about the openssl-commits mailing list