From 62c49fedf7daf6164fe2346109c96b40bcebb72f Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Wed, 15 Feb 2017 14:48:56 -0600 Subject: [PATCH] Scripts to easily apply and remove github Pull Requests --- scripts/github-apply | 10 ++++++++++ scripts/github-remove | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 scripts/github-apply create mode 100755 scripts/github-remove diff --git a/scripts/github-apply b/scripts/github-apply new file mode 100755 index 0000000000..16af1677ee --- /dev/null +++ b/scripts/github-apply @@ -0,0 +1,10 @@ +#!/bin/sh + +LIBRENMS_DIR=`dirname "$(readlink -f "$0/..")"` +cd $LIBRENMS_DIR + +if [ -z "$1" ]; then + echo "You must specify a PR number to apply a patch" +else + curl https://patch-diff.githubusercontent.com/raw/librenms/librenms/pull/${1}.patch | git apply -v ${2} +fi diff --git a/scripts/github-remove b/scripts/github-remove new file mode 100755 index 0000000000..7cfcd62da1 --- /dev/null +++ b/scripts/github-remove @@ -0,0 +1,28 @@ +#!/bin/sh + +LIBRENMS_DIR=`dirname "$(readlink -f "$0/..")"` +cd $LIBRENMS_DIR + +if [ "$1" == "-d" ]; then + # removing all uncommited changes + # git status + read -p "Are you sure you want to delete your changes? " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi + + git reset + git checkout --progress + git clean -d -f contrib/ doc/ html/ includes/ lib/ LibreNMS/ licenses/ mibs/ misc/ scripts/ sql-schema/ tests/ + if [ "$2" == "-v" ]; then + git clean -x -d -f vendor/ + fi +elif [ "$1" == "-h" ]; then + echo "Usage: $0 [-d [-v]]" + echo " Stashes changes by default. git stash list to see stashes" + echo " -d discard all uncommited changes" + echo " -v discard vendor directory changes too" +else + git stash +fi