Start updating contributing docs

This commit is contained in:
Nassim Jahnke
2024-12-07 17:41:32 +01:00
parent 40ec8fb606
commit c6233d8bcd
6 changed files with 55 additions and 214 deletions

View File

@ -1,54 +0,0 @@
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "$0 <prID>"
exit 1;
fi
repo=$(git remote get-url origin | sed -E 's/(.*@)?github.com(:|\/)//g' | sed 's/.git$//g')
data=$(curl -q https://api.github.com/repos/$repo/pulls/$1 2>/dev/null)
url=$(echo -e "$data" | grep --color=none ssh_url | head -n 1 |awk '{print $2}' | sed 's/"//g' | sed 's/,//g')
ref=$(echo -e "$data" | grep --color=none '"head":' -A 3 | grep ref | head -n 1 |awk '{print $2}' | sed 's/"//g' | sed 's/,//g')
prevbranch=$(\git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
branch="pr/$1"
up="pr-$1"
git remote remove $up 2>&1 1>/dev/null
git remote add -f $up $url
git branch -D $branch 2>/dev/null 1>&2
git checkout -b $branch $up/$ref 2>/dev/null|| true
echo "Merging $prevbranch into $branch"
git fetch origin
read -p "Press 'm' to merge, 'r' to rebase, or 'n' for nothing" -n 1 -r >&2
echo
if [[ "$REPLY" =~ ^[Mm]$ ]]; then
git merge origin/$prevbranch
elif [[ "$REPLY" =~ ^[Rr]$ ]]; then
git rebase master
fi
echo "Dropping to new shell, exit to delete the refs"
"${SHELL:-bash}" -i
read -p "Press 'p' to push. " -n 1 -r >&2
echo
pushed=0
if [[ "$REPLY" =~ ^[Pp]$ ]]; then
git push $up $branch:$ref -f
pushed=1
echo "Pushed" >&2
fi
echo "Deleting branch/upstream"
git checkout $prevbranch
if [[ "$pushed" == "1" ]]; then
read -p "Press 'm' to merge or 'r' to rebase merge " -n 1 -r >&2
if [[ "$REPLY" =~ ^[Mm]$ ]]; then
git merge $branch
fi
if [[ "$REPLY" =~ ^[Rr]$ ]]; then
git merge --ff-only $branch
fi
fi
git branch -D $branch
git remote remove $up
git gc
#git branch -u $up/$ref $branch
#git checkout $branch

View File

@ -1,38 +0,0 @@
#!/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 | sed -E 's/(^[0-9a-f]{8,}( (SPIGOT-[0-9]{1,4}|MC-[0-9]{1,6}),?)* |Revert ")#([0-9]+)/\1PR-\4/'
}
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 appear 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

View File

@ -1,41 +0,0 @@
#!/usr/bin/env bash
(
set -e
PS1="$"
basedir="$(cd "$1" && pwd -P)"
workdir="$basedir/work"
gitcmd="git -c commit.gpgsign=false"
updated="0"
function getRef {
git ls-tree $1 $2 | cut -d' ' -f3 | cut -f1
}
function update {
cd "$workdir/$1"
$gitcmd fetch && $gitcmd clean -fd && $gitcmd reset --hard origin/master
refRemote=$(git rev-parse HEAD)
cd ../
$gitcmd add --force $1
refHEAD=$(getRef HEAD "$workdir/$1")
echo "$1 $refHEAD - $refRemote"
if [ "$refHEAD" != "$refRemote" ]; then
export updated="1"
fi
}
update Bukkit
update CraftBukkit
update Spigot
if [[ "$2" = "all" || "$2" = "a" ]] ; then
update BuildData
fi
if [ "$updated" == "1" ]; then
echo "Rebuilding patches without filtering to improve apply ability"
cd "$basedir"
./gradlew cleanCache || exit 1 # todo: Figure out why this is necessary
./gradlew applyPatches -Dpaperweight.debug=true || exit 1
./gradlew rebuildPatches || exit 1
fi
)