[tools] master update

Dr. Paul Dale pauli at openssl.org
Mon Nov 16 09:37:35 UTC 2020


The branch master has been updated
       via  cbcbecab06afa0d3189153d0189556a494ec7397 (commit)
       via  3fc412099f1cb8715d53573927a21b0285cab431 (commit)
       via  55833dbceeca7f9a362b6c17ae8573aad3f2449e (commit)
       via  2b6037ffb38fb570c3c549380c817d7ddc02019d (commit)
       via  bba96aea70e34ede6207d385a4d2fac9bbd0484f (commit)
       via  c2ee3847c39b64c9db85ccd0ef57d480377b58a8 (commit)
       via  ff0730a5f63fad755ded50f93c0695ede14f52b5 (commit)
       via  fb12734b783b8fc960a30e9e45e1f83c0dc382f5 (commit)
       via  298a2fff2eb559f59cce2581a5bc9c01528df8bb (commit)
       via  97a10ae6e3f0067a5fc764d99f90422539499090 (commit)
       via  b853c16f7ab05ddef8868826ca79360d68c5a5be (commit)
       via  f083502396430ece48fbc16f4576f9a810834a0d (commit)
       via  0ad6ea00ee84d84a595867e667d01c392432a74b (commit)
       via  4737a26009ca5f05e0a73ee64c9eb5389de5b0b1 (commit)
       via  3c304bd9b7e5342d29b34579268523582acc8064 (commit)
       via  f4550d08e2e19c6c49814f4d31d945e317e50a5b (commit)
      from  b6beff129e2cd4c74a75cfd367056c7d8e9b1517 (commit)


- Log -----------------------------------------------------------------
commit cbcbecab06afa0d3189153d0189556a494ec7397
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Sat Nov 14 15:41:58 2020 +0100

    ghmerge: Add --help option and significantly extend usage hints (describing options)
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit 3fc412099f1cb8715d53573927a21b0285cab431
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 13:32:17 2020 +0200

    ghmerge: Rename variable 'REL' to more telling 'REF'
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit 55833dbceeca7f9a362b6c17ae8573aad3f2449e
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 13:11:28 2020 +0200

    ghmerge: Add --cherry-pick option (as alternative to rebase)
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit 2b6037ffb38fb570c3c549380c817d7ddc02019d
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 13:09:35 2020 +0200

    ghmerge: Remove redundant and error-prone 2nd rebase on current ref
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit bba96aea70e34ede6207d385a4d2fac9bbd0484f
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 13:02:29 2020 +0200

    ghmerge: Unify behavior on error in CLI arguments and improve usage output
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit c2ee3847c39b64c9db85ccd0ef57d480377b58a8
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 13:29:41 2020 +0200

    ghmerge: Make sure that on build error all error output is shown and then the tool exits
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit ff0730a5f63fad755ded50f93c0695ede14f52b5
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 15:29:01 2020 +0200

    ghmerge: Move adaptation of CC variable and improve the comment about it
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit fb12734b783b8fc960a30e9e45e1f83c0dc382f5
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 15:38:58 2020 +0200

    ghmerge: Automatically detect remote only if not explicitly given as option
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit 298a2fff2eb559f59cce2581a5bc9c01528df8bb
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 12:46:32 2020 +0200

    ghmerge: Improve flexibility providing reviewer names vs. commit refs (gitaddrev filter args)
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit 97a10ae6e3f0067a5fc764d99f90422539499090
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 15:52:16 2020 +0200

    ghmerge: Rename WORK branch that reflects the changes done by the PR
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit b853c16f7ab05ddef8868826ca79360d68c5a5be
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 09:43:00 2020 +0200

    ghmerge: Add --ref option to checkout given reference at first
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit f083502396430ece48fbc16f4576f9a810834a0d
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 09:41:26 2020 +0200

    ghmerge: Remove unused variable PREV
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit 0ad6ea00ee84d84a595867e667d01c392432a74b
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 09:39:47 2020 +0200

    ghmerge: Improve diagnostics on cleanup, distinguishing failure and non-error exit
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit 4737a26009ca5f05e0a73ee64c9eb5389de5b0b1
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 09:37:02 2020 +0200

    ghmerge: Various small improvements on user interaction, extending messages etc.
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit 3c304bd9b7e5342d29b34579268523582acc8064
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 16:41:35 2020 +0200

    addrev: Add warning on overriding filter args
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

commit f4550d08e2e19c6c49814f4d31d945e317e50a5b
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Oct 8 09:34:12 2020 +0200

    addrev: Improve flexibility providing reviewer names vs. commit refs (filter args)
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/72)

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

Summary of changes:
 review-tools/addrev  |  16 ++++-
 review-tools/ghmerge | 173 ++++++++++++++++++++++++++++++++++++---------------
 2 files changed, 137 insertions(+), 52 deletions(-)

diff --git a/review-tools/addrev b/review-tools/addrev
index 5617199..5221500 100755
--- a/review-tools/addrev
+++ b/review-tools/addrev
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 
 my $args = "";
-my $filterargs = "HEAD^..";
+my $filterargs = "";
 my $list_reviewers = 0;
 my $help = 0;
 my $haveprnum = 0;
@@ -14,8 +14,15 @@ my $useself = 1;
 my $my_email;
 
 foreach (@ARGV) {
-    if (/^[a-z]+$/ || /^\@\w(?:[-\w]*\w)?$/) {
+    if (/^\@.+$/) {
         $args .= "--reviewer=$_ ";
+    } elsif (/^[-\w]+$/) {
+        if (/^[0-9a-f]{7,}+/) {
+            print "Warning: overriding previous filter args $filterargs\n" if $filterargs ne "";
+            $filterargs = $_;
+        } else {
+            $args .= "--reviewer=$_ ";
+        }
     } elsif (/^--reviewer=(.+)$/) {
         $args .= "--reviewer=$1 ";
     } elsif (/^--rmreviewers$/) {
@@ -40,6 +47,7 @@ foreach (@ARGV) {
     } elsif (/^--commit=(.+)$/) {
         $args .= "--commit=$1 ";
     } elsif (/^-(\d+)$/) {
+        print "Warning: overriding previous filter args $filterargs\n" if $filterargs ne "";
         $filterargs = "HEAD~$1..";
     } elsif (/^--list$/) {
 	$list_reviewers = 1;
@@ -48,9 +56,11 @@ foreach (@ARGV) {
 	$help = 1;
 	last;
     } else {
+        print "Warning: overriding previous filter args $filterargs\n" if $filterargs ne "";
         $filterargs = $_;
     }
 }
+$filterargs = "HEAD^.." if $filterargs eq "";
 
 if ($list_reviewers) {
     system("gitaddrev --list");
@@ -98,7 +108,7 @@ option style arguments:
 
 non-option style arguments can be:
 
-a string of lower case letters, denoting a reviewer name.
+a string of alphanumeric or '-' characters, denoting a reviewer name.
 
 a string starting with \@, denoting a reviewer's github ID.
 
diff --git a/review-tools/ghmerge b/review-tools/ghmerge
index 9c8a903..1384a89 100755
--- a/review-tools/ghmerge
+++ b/review-tools/ghmerge
@@ -1,33 +1,65 @@
 #! /bin/bash
 
+function usage_exit {
+    >&2 echo "Usage: ghmerge <options including prnum and reviewer(s)>
+    or ghmerge [<options>] -- <prnum> <reviewer>...
+Options may include addrev options and gitaddrev filter args.
+
+Option style arguments:
+
+--help              Print this help and exit
+--tools             Merge a tools PR (rather than openssl PR)
+--web               Merge a web PR (rather than openssl PR)
+--remote <remote>   Merge with given repo (rather than implicit upstream)
+--ref <branch>      Merge with given branch (rather than impliict master)
+--cherry-pick       Use cherry-pick (rather than pull --rebase)
+--squash            Squash new commits non-interactively (allows editing msg)
+--noautosquash      Do not automatically squash fixups in interactive rebase
+--nobuild           Do not call 'openssbuild' before merging
+
+Examples:
+
+  ghmerge 12345 mattcaswell
+  ghmerge 12345 paulidale t8m --nobuild --myemail=dev at ddvo.net
+  ghmerge edd05b7^^^^..19692bb2c32 --squash -- 12345 levitte"
+    exit 9
+}
+
 set -o errexit
 
 WHAT=openssl
-BUILD=yes
+PICK=no
 INTERACTIVE=yes
 AUTOSQUASH="--autosquash"
-[ -z ${CC+x} ] && CC="ccache gcc" # the default otherwise is "ccache clang-3.6"
-REMOTE=`git remote -v | awk '/git.openssl.org.*(push)/{ print $1; }' | head -n 1`
-if [ "$REMOTE" = "" ] ; then
-    echo Cannot find remote git.openssl.org
-    exit 1
-fi
+REMOTE=""
+REF=""
+BUILD=yes
+[ -z ${CC+x} ] && CC="ccache gcc" # opensslbuild will otherwise use "ccache clang-3.6"
 
 if [ ! -d .git ] ; then
-    echo Not at top-level
+    echo Not at a top-level git directory
     exit 1
 fi
 
+PRNUM=
+TEAM=""
 ADDREVOPTS=""
 # Parse JCL.
-while true ; do
+shopt -s extglob
+while [ $# -ne 0 ]; do
     case "$1" in
+    --help)
+        usage_exit
+        ;;
     --tools)
         WHAT=tools ; BUILD=no ; shift
         ;;
     --web)
         WHAT=web ; BUILD=no ; shift
         ;;
+    --cherry-pick)
+        PICK=yes ; shift
+        ;;
     --noautosquash)
         AUTOSQUASH="" ; shift
         ;;
@@ -40,31 +72,60 @@ while true ; do
     --remote)
         if [ $# -lt 2 ] ; then
             echo "Missing argument of '$1'"
-            exit 1
+            usage_exit
         fi
         shift; REMOTE=$1; shift
         ;;
+    --ref)
+        if [ $# -lt 2 ] ; then
+            echo "Missing argument of '$1'"
+            usage_exit
+        fi
+        shift; REF=$1; shift
+        ;;
     --)
-        shift
+        if [ $# -lt 3 ] ; then
+            echo "Missing <prnum> <reviewer>... after '--'"
+            usage_exit
+        fi
+        shift; PRNUM=$1 ; shift
+        TEAM="$TEAM $*"
         break
         ;;
     -*) # e.g., --verbose, --trivial, --myemail=...
         ADDREVOPTS="$ADDREVOPTS $1"
         shift
-        break
         ;;
-    *)
-        break
+    +([[:digit:]]) ) # e.g., 1453
+        PRNUM=$1; shift
+        ;;
+    @*) # e.g., @t8m
+        TEAM="$TEAM $1"; shift
+        ;;
+    +([[:alnum:]-]) ) # e.g., levitte
+        if [[ $1 =~ ^[0-9a-f]{7,}+$ ]]; then # e.g., edd05b7
+            ADDREVOPTS="$ADDREVOPTS $1"
+        else
+            TEAM="$TEAM $1"
+        fi
+        shift
+        ;;
+    *) # e.g., edd05b7^^^^..19692bb2c32
+        ADDREVOPTS="$ADDREVOPTS $1"; shift
         ;;
     esac
 done
+ADDREVOPTS=${ADDREVOPTS# } # chop any leading ' '
 
-if [ $# -lt 2 ] ; then
-    echo "Usage: $0 [flags, including addrev flags] prnum reviewer..."
+[ "$REMOTE" = "" ] && REMOTE=`git remote -v | awk '/git.openssl.org.*(push)/{ print $1; }' | head -n 1`
+if [ "$REMOTE" = "" ] ; then
+    echo Cannot find git remote with URL including 'git.openssl.org'
     exit 1
 fi
-PRNUM=$1 ; shift
-TEAM=$*
+
+if [ "$PRNUM" = "" -o "$TEAM" = "" ] ; then
+    usage_exit
+fi
 
 PR_URL=https://api.github.com/repos/openssl/$WHAT/pulls/$PRNUM
 if ! wget --quiet $PR_URL -O /tmp/gh$$; then
@@ -82,68 +143,82 @@ BRANCH=$2
 REPO=$3
 rm /tmp/gh$$
 
-if [ -z "$WHO" -o -z "$BRANCH" ]; then
-    echo "Don't know from which branch to fetch"
+if [ -z "$WHO" -o -z "$BRANCH" -o -z "$REPO" ]; then
+    echo "Could not determine from $PR_URL which branch of whom to fetch from where"
     exit 1
 fi
 
-REL=`git rev-parse --abbrev-ref HEAD`
-WORK="${WHO}-${BRANCH}"
-PREV=
+if [ "$REF" = "" ]; then
+    REF=`git rev-parse --abbrev-ref HEAD` # usually will be 'HEAD' or e.g., OpenSSL_1_1_1-stable
+else
+    echo -n "Press Enter to checkout $REF: "; read foo
+    git checkout $REF
+fi
 
-echo -n "Press Enter to pull the latest branch '$REL' from $REMOTE: "; read foo
-git pull $REMOTE $REL
+echo -n "Press Enter to pull the latest $REMOTE/$REF: "; read foo
+git pull $REMOTE || (git rebase --abort; exit 1)
+
+WORK="copy-of-${WHO}-${BRANCH}"
 
 function cleanup {
-    if [ "$WORK" != "$REL" ]; then
-        git checkout -q $REL
-        git branch -D $WORK
-        git reset --hard $REMOTE/$REL # prune any leftover commits added locally
+    rv=$?
+    echo # new line
+    [ $rv -ne 0 ] && echo -e "\nghmerge failed"
+    if [ "$WORK" != "$REF" ]; then
+        echo Restoring local $REF
+        git checkout -q $REF
+        git branch -qD $WORK 2>/dev/null
     fi
+    git reset --hard $REMOTE/$REF # prune any leftover commits added locally
 }
 trap 'cleanup' EXIT
 
-git checkout -b $WORK $REL
+git checkout -b $WORK $REF
 
 # append new commits from $REPO/$BRANCH
-git pull --rebase $REPO $BRANCH
-echo rebasing $BRANCH on $REL
-git rebase $REL || (git rebase --abort; exit 1)
+if [ "$PICK" != "yes" ]; then
+    echo Rebasing $REPO/$BRANCH on $REF...
+    git pull --rebase $REPO $BRANCH || (git rebase --abort; exit 1)
+else
+    echo Cherry-picking $REPO/$BRANCH to $REF...
+    git fetch $REPO $BRANCH && git cherry-pick FETCH_HEAD
+fi
 
-echo Diff against $REL
-git diff $REL
+echo Diff against $REF
+git diff $REF
 
 if [ "$INTERACTIVE" == "yes" ] ; then
-    echo -n "Press Enter to interactively rebase $AUTOSQUASH $BRANCH on $REL: "; read foo
-    git rebase -i $AUTOSQUASH $REL || (git rebase --abort; exit 1)
-    addrev $ADDREVOPTS --prnum=$PRNUM $TEAM ${REL}..
+    echo -n "Press Enter to interactively rebase $AUTOSQUASH on $REF: "; read foo
+    git rebase -i $AUTOSQUASH $REF || (git rebase --abort; exit 1)
+    echo "Calling addrev $ADDREVOPTS --prnum=$PRNUM $TEAM ${REF}.."
+    addrev $ADDREVOPTS --prnum=$PRNUM $TEAM ${REF}..
 fi
 
-echo Log since $REL
-git log $REL..
+echo Log since $REF
+git log $REF..
 
-git checkout $REL
+git checkout $REF
 if [ "$INTERACTIVE" != "yes" ] ; then
-    echo -n "Press Enter to non-interactively merge --squash $BRANCH to $REL: "; read foo
+    echo -n "Press Enter to non-interactively merge --squash $BRANCH to $REF: "; read foo
     git merge --ff-only --no-commit --squash $WORK
     AUTHOR=`git show --no-patch --pretty="format:%an <%ae>" $WORK`
     git commit --author="$AUTHOR"
-    addrev $ADDREVOPTS --prnum=$PRNUM $TEAM $REMOTE/${REL}..
+    addrev $ADDREVOPTS --prnum=$PRNUM $TEAM $REMOTE/${REF}..
 else
-    # echo -n "Press Enter to merge to $REL: "; read foo
+    # echo -n "Press Enter to merge to $REF: "; read foo
     git merge --ff-only $WORK
 fi
 
-echo New log since $REMOTE/$REL
-git log $REMOTE/$REL..
+echo New log since $REMOTE/$REF
+git log $REMOTE/$REF..
 
 if [ "$BUILD" == "yes" ] ; then
     echo Rebuilding...
-    ( CC="$CC" opensslbuild 2>&1 ) | tail -3
+    CC="$CC" opensslbuild >/dev/null # any STDERR output will be shown
 fi
 
 while true ; do
-    echo -n "Enter 'yes' to push to $REMOTE/$REL or 'no' to abort: "
+    echo -n "Enter 'y'/'yes' to push to $REMOTE/$REF 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" ] ; then
@@ -152,5 +227,5 @@ while true ; do
 done
 
 if [ "$x" = "y" -o "$x" = "yes" ] ; then
-    git push -v $REMOTE $REL
+    git push -v $REMOTE $REF
 fi


More information about the openssl-commits mailing list