Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

some helper scripts to make management of the source a touch easier

  • Loading branch information...
commit d20e986ebfefcf0894e82497facc23e3282444e8 1 parent c31b942
@k-anderson k-anderson authored
View
47 bin/git_all_beams_to_head.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+fWelcome() {
+ clear
+ echo "======================================================="
+ echo " _ _ _ _ _ _____ _ _______ _ _______ "
+ echo "| || || | | | (_____) | | (_______) | (_______)"
+ echo "| || || | |__ | | _ \ \ _ | | _____ "
+ echo "| ||_|| | __)| | | | \ \| | | | | ___) "
+ echo "| |___| | | | |_| |_ _____) ) |_____| |_____| |_____ "
+ echo " \______|_| |_(_____|______/ \______)_______)_______)"
+ echo " - - - Signaling the start of next generation telephony"
+ echo "======================================================="
+ echo
+}
+
+fCheckoutBeam() {
+ echo "# git checkout HEAD $1"
+
+ git checkout HEAD $1
+
+ return $?
+}
+
+fConfirm() {
+ read -p "This will revert all beams to the HEAD versions. Are you sure you want to do this(y/N)? " -n 1
+
+ for confirm in y Y yes YES Yes; do
+ [ "${REPLY}" == "${confirm}" ] && echo && return 0
+ done
+
+ echo
+ return 1
+}
+
+cd `dirname $0`
+
+fWelcome
+fConfirm || exit 1
+
+while read beam; do
+ fCheckoutBeam $beam || exit 1
+done < <(find ../ -name "*.beam")
+
+echo "All erlang beam files reverted to HEAD versions."
+
+exit 0
View
36 bin/git_remove_ignored.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+fWelcome() {
+ clear
+ echo "======================================================="
+ echo " _ _ _ _ _ _____ _ _______ _ _______ "
+ echo "| || || | | | (_____) | | (_______) | (_______)"
+ echo "| || || | |__ | | _ \ \ _ | | _____ "
+ echo "| ||_|| | __)| | | | \ \| | | | | ___) "
+ echo "| |___| | | | |_| |_ _____) ) |_____| |_____| |_____ "
+ echo " \______|_| |_(_____|______/ \______)_______)_______)"
+ echo " - - - Signaling the start of next generation telephony"
+ echo "======================================================="
+ echo
+}
+
+fFindIgnoredFiles() {
+ while read file; do
+ fGitRm ${file}
+ done < <(find ../ -name "$1")
+}
+
+fGitRm() {
+ echo "# git rm --cached $1"
+ git rm --cached $1
+}
+
+cd `dirname $0`
+
+fWelcome
+
+while read ignore; do
+ fFindIgnoredFiles ${ignore}
+done < ../.gitignore
+
+echo "All ignored files removed from git, please commit any changes now."
View
4 bin/git_setup.sh
@@ -90,3 +90,7 @@ fGetEmail
fSetupUser
fEnableRerere
+
+echo "Git configuration complete."
+
+exit 0
View
40 bin/git_track_remote.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+fWelcome() {
+ clear
+ echo "======================================================="
+ echo " _ _ _ _ _ _____ _ _______ _ _______ "
+ echo "| || || | | | (_____) | | (_______) | (_______)"
+ echo "| || || | |__ | | _ \ \ _ | | _____ "
+ echo "| ||_|| | __)| | | | \ \| | | | | ___) "
+ echo "| |___| | | | |_| |_ _____) ) |_____| |_____| |_____ "
+ echo " \______|_| |_(_____|______/ \______)_______)_______)"
+ echo " - - - Signaling the start of next generation telephony"
+ echo "======================================================="
+ echo
+}
+
+fCleanUpLocal() {
+ echo "# git gc --prune=now"
+ git gc --prune=now
+}
+
+fCreateMissingBranches() {
+ while read r; do
+ l="`echo -n $r | cut -d/ -f 2`"
+ if [[ -z "`git branch | grep $l`" && "$l" != "HEAD" ]]; then
+ echo "# git branch --track $l $r"
+ git branch --track $l $r
+ fi
+ done < <(git for-each-ref --format='%(refname:short)' refs/remotes)
+}
+
+cd `dirname $0`
+
+fWelcome
+fCleanUpLocal
+fCreateMissingBranches
+
+echo "Whistle remote branches imported"
+
+exit 0
View
51 bin/git_update.sh
@@ -17,10 +17,19 @@ fWelcome() {
echo
}
+fMaintance() {
+ echo "# git gc"
+ git gc
+}
+
fStash() {
- echo "# git stash"
- git stash || fStashFail
- return $?
+ if [ ! -z "$(git diff-files)" ]; then
+ echo "# git stash"
+ git stash || fStashFail
+ trap "fCleanup $CURRENT_BRANCH TRUE" 0 1 2 5 15
+ else
+ trap "fCleanup $CURRENT_BRANCH FALSE" 0 1 2 5 15
+ fi
}
fStashFail() {
@@ -52,6 +61,7 @@ fFetchFail() {
}
fCheckout() {
+ [ "$1" == "`git status | grep 'On branch' | cut -d ' ' -f 4`" ] && return 0
echo "# git checkout $1"
git checkout $1 || fCheckoutFail
return $?
@@ -147,6 +157,15 @@ fMergeAllBranches() {
done < <(git for-each-ref --format='%(refname:short)' refs/heads/*)
}
+fMergeCurrentBranch() {
+ b="${CURRENT_BRANCH}"
+
+ if r=$(git config --get branch.$b.remote); then
+ m=$(git config --get branch.$b.merge)
+ fMerge $r/${m##*/} #&& fSubModule
+ fi
+}
+
fCleanup() {
if [ "$2" == "TRUE" ]; then
fCheckout $1 && fStashPop
@@ -157,17 +176,23 @@ fCleanup() {
cd `dirname $0`
+while [ -n "$*" ]; do
+ case "x$1" in
+ x--all)
+ all_branches="true"
+ ;;
+ esac
+ shift
+done
+
fGetCurrentBranch
+fWelcome
+fMaintance
+fStash
+fFetch
-clear
+([ -z "${all_branches}" ] && fMergeCurrentBranch) || fMergeAllBranches
-if [ ! -z "$(git diff-files)" ]; then
- fStash
- trap "fCleanup $CURRENT_BRANCH TRUE" 0 1 2 5 15
-else
- trap "fCleanup $CURRENT_BRANCH FALSE" 0 1 2 5 15
-fi
+echo "Whistle updated, enjoy!"
-fWelcome
-fFetch
-fMergeAllBranches
+exit 0
Please sign in to comment.
Something went wrong with that request. Please try again.