Merge elementsproject/secp256k1-zkp#251: Update sync-upstream with master

7e9193666f840eaec024d1dad968361b79a14753 ci: Always define EXPERIMENTAL variable (Tim Ruffing)
0a9915687191cabba0241bd45c3a3416b7f36e29 sync-upstream.sh: Add "git show --remerge-diff" tip (Tim Ruffing)
9b6a1c384d00cc61bf9160e5df858ca6c52e6af3 sync-upstream.sh: Fix position of "-b" option in reproduce command (Tim Ruffing)
05b207e969f9b4181061dd3fba749b6df06de718 sync-upstream: allows providing the local branch via cli (Jonas Nick)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK 7e9193666f840eaec024d1dad968361b79a14753

Tree-SHA512: 4527cb6a2493d210eb7ba6d8f6e717b2acbc07aebdc1c4011cffe23490876a4e795d656a69df2cd50e4e3fe8742c123d9ea493914c148c8fbc93d7d3799e7447
This commit is contained in:
Jonas Nick 2023-07-21 13:28:08 +00:00
commit 897c765a49
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
2 changed files with 32 additions and 15 deletions

View File

@ -15,6 +15,7 @@ env:
WITH_VALGRIND: yes WITH_VALGRIND: yes
EXTRAFLAGS: EXTRAFLAGS:
### secp256k1 modules ### secp256k1 modules
EXPERIMENTAL: no
ECDH: no ECDH: no
RECOVERY: no RECOVERY: no
SCHNORRSIG: no SCHNORRSIG: no

View File

@ -3,12 +3,13 @@
set -eou pipefail set -eou pipefail
help() { help() {
echo "$0 range [end]" echo "$0 [-b <branch>] range [end]"
echo " merges every merge commit present in upstream and missing locally." echo " merges every merge commit present in upstream and missing in <branch> (default: master)."
echo " If the optional [end] commit is provided, only merges up to [end]." echo " If the optional [end] commit is provided, only merges up to [end]."
echo " If the optional [-b branch] provided, then ."
echo echo
echo "$0 select <commit> ... <commit>" echo "$0 [-b <branch>] select <commit> ... <commit>"
echo " merges every selected merge commit" echo " merges every selected merge commit into <branch> (default: master)"
echo echo
echo "This tool creates a branch and a script that can be executed to create the" echo "This tool creates a branch and a script that can be executed to create the"
echo "PR automatically. The script requires the github-cli tool (aka gh)." echo "PR automatically. The script requires the github-cli tool (aka gh)."
@ -17,12 +18,9 @@ help() {
exit 1 exit 1
} }
if [ "$#" -lt 1 ]; then
help
fi
REMOTE=upstream REMOTE=upstream
REMOTE_BRANCH="$REMOTE/master" REMOTE_BRANCH="$REMOTE/master"
LOCAL_BRANCH="master"
# Makes sure you have a remote "upstream" that is up-to-date # Makes sure you have a remote "upstream" that is up-to-date
setup() { setup() {
ret=0 ret=0
@ -41,7 +39,7 @@ setup() {
} }
range() { range() {
RANGESTART_COMMIT=$(git merge-base "$REMOTE_BRANCH" master) RANGESTART_COMMIT=$(git merge-base "$REMOTE_BRANCH" "$LOCAL_BRANCH")
RANGEEND_COMMIT=$(git rev-parse "$REMOTE_BRANCH") RANGEEND_COMMIT=$(git rev-parse "$REMOTE_BRANCH")
if [ "$#" = 1 ]; then if [ "$#" = 1 ]; then
RANGEEND_COMMIT=$1 RANGEEND_COMMIT=$1
@ -57,18 +55,37 @@ range() {
esac esac
} }
# Process -b <branch> argument
while getopts "b:" opt; do
case $opt in
b)
LOCAL_BRANCH=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
# Shift off the processed options
shift $((OPTIND -1))
if [ "$#" -lt 1 ]; then
help
fi
case $1 in case $1 in
range) range)
shift shift
setup setup
range "$@" range "$@"
REPRODUCE_COMMAND="$0 range $RANGEEND_COMMIT" REPRODUCE_COMMAND="$0 -b $LOCAL_BRANCH range $RANGEEND_COMMIT"
;; ;;
select) select)
shift shift
setup setup
COMMITS=$* COMMITS=$*
REPRODUCE_COMMAND="$0 select $@" REPRODUCE_COMMAND="$0 -b $LOCAL_BRANCH select $@"
;; ;;
help) help)
help help
@ -87,8 +104,7 @@ do
done done
# Remove trailing "," # Remove trailing ","
TITLE=${TITLE%?} TITLE=${TITLE%?}
BODY=$(printf "%s\n\n%s\n%s" "$BODY" "This PR can be recreated with \`$REPRODUCE_COMMAND\`." "Tip: Use \`git show --remerge-diff\` to show the changes manually added to the merge commit.")
BODY=$(printf "%s\n\n%s" "$BODY" "This PR can be recreated with \`$REPRODUCE_COMMAND\`.")
echo "-----------------------------------" echo "-----------------------------------"
echo "$TITLE" echo "$TITLE"
@ -96,7 +112,7 @@ echo "-----------------------------------"
echo "$BODY" echo "$BODY"
echo "-----------------------------------" echo "-----------------------------------"
# Create branch from PR commit and create PR # Create branch from PR commit and create PR
git checkout master git checkout "$LOCAL_BRANCH"
git pull --autostash git pull --autostash
git checkout -b temp-merge-"$PRNUM" git checkout -b temp-merge-"$PRNUM"
@ -115,7 +131,7 @@ cat <<EOT > "$FNAME"
#!/bin/sh #!/bin/sh
gh pr create -t '$TITLE' -b '$BODY' --web gh pr create -t '$TITLE' -b '$BODY' --web
# Remove temporary branch # Remove temporary branch
git checkout master git checkout "$LOCAL_BRANCH"
git branch -D temp-merge-"$PRNUM" git branch -D temp-merge-"$PRNUM"
EOT EOT
chmod +x "$FNAME" chmod +x "$FNAME"