diff options
Diffstat (limited to 'stale/hooks.sh')
| -rw-r--r-- | stale/hooks.sh | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/stale/hooks.sh b/stale/hooks.sh new file mode 100644 index 0000000..d8add42 --- /dev/null +++ b/stale/hooks.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +email=$1 +patch=/tmp/$$.patch +tempfile=/tmp/item_menu.$$ +sources=~/pristine/ + + + +clear_repo(){ + dialog --clear --yesno \ + " Wanna reset the git tree?" 0 0 + + if [ $? -eq 0 ]; then + git reset --hard + fi +} + +diff_patch(){ + + dialog --clear --yesno --yes-label "git diff" --no-label "difftool" \ + "Choose DIFF format:" 0 0 + + if [ $? -eq 0 ]; then + git diff + else + git difftool + fi + +} + +apply_patch(){ + repolist=$(ls $sources | awk '{print $1,$1}') + + dialog --clear --menu "Select repository to apply the patch" 0 0 20 $repolist 2> $tempfile + #"Select repository to apply the patch" 30 60 20 $repolist 2> $tempfile + + repo=`cat $tempfile` + + echo $repo + cd $sources/$repo + git apply $patch + #diff_patch + clear_repo +} + +clear_env(){ + rm -rf $tempfile + rm -rf $patch +} + +###main + +cat $email | formail -I "" > $patch +#cat $email | formail -I "" | awk '/^---/{p=1}p' > /tmp/patch.patch +apply_patch +clear_env |
