mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Update scripts
This commit is contained in:
@@ -1,65 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
# BEGIN config
|
||||
FORK_NAME="Purpur"
|
||||
API_REPO=""
|
||||
SERVER_REPO=""
|
||||
PAPER_API_REPO=""
|
||||
PAPER_SERVER_REPO=""
|
||||
MCDEV_REPO=""
|
||||
# END config
|
||||
|
||||
sourceBase=$(dirname $SOURCE)/../
|
||||
cd ${basedir:-$sourceBase}
|
||||
sourceBase=$(dirname "$SOURCE")/../
|
||||
cd "${basedir:-$sourceBase}" || exit
|
||||
|
||||
basedir=$(pwd -P)
|
||||
cd -
|
||||
cd - || exit
|
||||
|
||||
|
||||
function bashColor {
|
||||
if [ $2 ]; then
|
||||
echo -e "\e[$1;$2m"
|
||||
else
|
||||
echo -e "\e[$1m"
|
||||
fi
|
||||
function bashColor() {
|
||||
if [ "$2" ]; then
|
||||
echo -e "\e[$1;$2m"
|
||||
else
|
||||
echo -e "\e[$1m"
|
||||
fi
|
||||
}
|
||||
function bashColorReset {
|
||||
echo -e "\e[m"
|
||||
function bashColorReset() {
|
||||
echo -e "\e[m"
|
||||
}
|
||||
|
||||
function cleanupPatches {
|
||||
cd "$1"
|
||||
for patch in *.patch; do
|
||||
gitver=$(tail -n 2 $patch | grep -ve "^$" | tail -n 1)
|
||||
diffs=$(git diff --staged $patch | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index|Date\: )")
|
||||
function cleanupPatches() {
|
||||
cd "$1" || exit
|
||||
for patch in *.patch; do
|
||||
gitver=$(tail -n 2 "$patch" | grep -ve "^$" | tail -n 1)
|
||||
diffs=$(git diff --staged "$patch" | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index|Date\: )")
|
||||
|
||||
testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver")
|
||||
if [ "x$testver" != "x" ]; then
|
||||
diffs=$(echo "$diffs" | tail -n +3)
|
||||
fi
|
||||
testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver")
|
||||
if [ "x$testver" != "x" ]; then
|
||||
diffs=$(echo "$diffs" | tail -n +3)
|
||||
fi
|
||||
|
||||
if [ "x$diffs" == "x" ] ; then
|
||||
git reset HEAD $patch >/dev/null
|
||||
git checkout -- $patch >/dev/null
|
||||
fi
|
||||
done
|
||||
if [ "x$diffs" == "x" ]; then
|
||||
git reset HEAD "$patch" >/dev/null
|
||||
git checkout -- "$patch" >/dev/null
|
||||
fi
|
||||
done
|
||||
}
|
||||
function pushRepo {
|
||||
if [ "$(git config minecraft.push-${FORK_NAME})" == "1" ]; then
|
||||
echo "Pushing - $1 ($3) to $2"
|
||||
(
|
||||
cd "$1"
|
||||
git remote rm emc-push > /dev/null 2>&1
|
||||
git remote add emc-push $2 >/dev/null 2>&1
|
||||
git push emc-push $3 -f
|
||||
)
|
||||
fi
|
||||
function basedir() {
|
||||
cd "$basedir" || exit
|
||||
}
|
||||
function basedir {
|
||||
cd "$basedir"
|
||||
}
|
||||
function gethead {
|
||||
(
|
||||
cd "$1"
|
||||
git log -1 --oneline
|
||||
)
|
||||
function gethead() {
|
||||
(
|
||||
cd "$1" || exit
|
||||
git log -1 --oneline
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user