sync-upstream: Fix output of command to reproduce

This commit is contained in:
Tim Ruffing 2021-03-10 16:02:32 +01:00
parent 38f1e777d4
commit 136ed8f84d

View File

@ -4,7 +4,7 @@ set -eou pipefail
help() { help() {
echo "$0 range [end]" echo "$0 range [end]"
echo " merges every merge commit missing merge commit." echo " merges every merge commit present in upstream and missing locally."
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 echo
echo "$0 select <commit> ... <commit>" echo "$0 select <commit> ... <commit>"
@ -42,7 +42,7 @@ setup() {
range() { range() {
RANGESTART_COMMIT=$(git merge-base $REMOTE_BRANCH master) RANGESTART_COMMIT=$(git merge-base $REMOTE_BRANCH master)
RANGEEND_COMMIT=$REMOTE_BRANCH RANGEEND_COMMIT=$(git rev-parse $REMOTE_BRANCH)
if [ "$#" = 1 ]; then if [ "$#" = 1 ]; then
RANGEEND_COMMIT=$1 RANGEEND_COMMIT=$1
fi fi
@ -62,11 +62,13 @@ case $1 in
shift shift
setup setup
range "$@" range "$@"
REPRODUCE_COMMAND="$0 range $RANGEEND_COMMIT"
;; ;;
select) select)
shift shift
setup setup
COMMITS=$* COMMITS=$*
REPRODUCE_COMMAND="$0 $@"
;; ;;
help) help)
help help
@ -86,7 +88,7 @@ done
# Remove trailing "," # Remove trailing ","
TITLE=${TITLE%?} TITLE=${TITLE%?}
BODY=$(printf "%s\n\n%s" "$BODY" "This PR was automatically created with \\\`$0 $*\\\`.") BODY=$(printf "%s\n\n%s" "$BODY" "This PR can be recreated with \`$REPRODUCE_COMMAND\`.")
echo "-----------------------------------" echo "-----------------------------------"
echo "$TITLE" echo "$TITLE"