summaryrefslogtreecommitdiff
path: root/stale/hooks.sh
diff options
context:
space:
mode:
authorCarlos Maiolino <[email protected]>2024-04-21 13:52:26 +0200
committerCarlos Maiolino <[email protected]>2024-04-21 13:52:26 +0200
commit47b7016ed5ac6dd8efc041060d62e632e937a6d2 (patch)
tree2540760186b400288565c2d2f67dd3c3e93bcfe0 /stale/hooks.sh
Initial commit
Diffstat (limited to 'stale/hooks.sh')
-rw-r--r--stale/hooks.sh57
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