From c341aad25ec73e94d2a6632e7473486af500e6e8 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 5 Aug 2018 21:31:40 -0400 Subject: [PATCH] [CI-SKIP] Add script to commit upstream changelogs Paper team can do paper upcommit when manual upstream updates are needed this will generate a changelog of everything that has changed between then and now. --- paper | 8 +++++++- scripts/upstreamCommit.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100755 scripts/upstreamCommit.sh diff --git a/paper b/paper index 8c2f4ffdc5..a368d58c2f 100755 --- a/paper +++ b/paper @@ -82,6 +82,12 @@ case "$1" in scripts/upstreamMerge.sh "$basedir" "$2" ) ;; + "cu" | "commitup" | "commitupstream" | "upcommit" | "upstreamcommit") + ( + cd "$basedir" + scripts/upstreamCommit.sh "$@" + ) + ;; "r" | "root") cd "$basedir" ;; @@ -198,4 +204,4 @@ if [ "$failed" == "1" ]; then else unset failed true -fi \ No newline at end of file +fi diff --git a/scripts/upstreamCommit.sh b/scripts/upstreamCommit.sh new file mode 100755 index 0000000000..9937f2f25c --- /dev/null +++ b/scripts/upstreamCommit.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +( +set -e +PS1="$" + +function changelog() { + base=$(git ls-tree HEAD $1 | cut -d' ' -f3 | cut -f1) + cd $1 && git log --oneline ${base}...HEAD +} +bukkit=$(changelog work/Bukkit) +cb=$(changelog work/CraftBukkit) +spigot=$(changelog work/Spigot) + +updated="" +logsuffix="" +if [ ! -z "$bukkit" ]; then + logsuffix="$logsuffix\n\nBukkit Changes:\n$bukkit" + updated="Bukkit" +fi +if [ ! -z "$cb" ]; then + logsuffix="$logsuffix\n\nCraftBukkit Changes:\n$cb" + if [ -z "$updated" ]; then updated="CraftBukkit"; else updated="$updated/CraftBukkit"; fi +fi +if [ ! -z "$spigot" ]; then + logsuffix="$logsuffix\n\nSpigot Changes:\n$spigot" + if [ -z "$updated" ]; then updated="Spigot"; else updated="$updated/Spigot"; fi +fi +disclaimer="Upstream has released updates that appears to apply and compile correctly.\nThis update has not been tested by PaperMC and as with ANY update, please do your own testing" + +if [ ! -z "$1" ]; then + disclaimer="$@" +fi + +log="${UP_LOG_PREFIX}Updated Upstream ($updated)\n\n${disclaimer}${logsuffix}" + +echo -e "$log" | git commit -F - + +) || exit 1