mutt: add some patch cmds
This commit is contained in:
parent
c37cd39404
commit
d0cbe54bb6
36
.mutt/bin/patch_apply.sh
Executable file
36
.mutt/bin/patch_apply.sh
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# store patch
|
||||||
|
file="$(mktemp ${TMPDIR-/tmp}/mutt-patch-apply-XXXXXXXX)"
|
||||||
|
trap "rm -f $file" EXIT
|
||||||
|
cat > "$file"
|
||||||
|
|
||||||
|
# find project
|
||||||
|
#source ~/.mutt/bin/patch-find-project.sh
|
||||||
|
#if test "$project" = ""; then
|
||||||
|
# echo "ERROR: can't figure project"
|
||||||
|
# exit 1
|
||||||
|
#fi
|
||||||
|
#
|
||||||
|
## go!
|
||||||
|
#clear
|
||||||
|
#cd $HOME/projects/$project
|
||||||
|
project=$(pwd)
|
||||||
|
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo "#"
|
||||||
|
echo "# try applying patch to $project, branch $branch"
|
||||||
|
echo "#"
|
||||||
|
|
||||||
|
if git am --message-id --3way --ignore-whitespace --whitespace=fix "$file"; then
|
||||||
|
echo "#"
|
||||||
|
echo "# OK"
|
||||||
|
echo "#"
|
||||||
|
else
|
||||||
|
echo "# FAILED, cleaning up"
|
||||||
|
cp -v .git/rebase-apply/patch patch-apply-failed.diff
|
||||||
|
cp -v "$file" patch-apply-failed.mail
|
||||||
|
git am --abort
|
||||||
|
git reset --hard
|
||||||
|
fi
|
15
.mutt/bin/patch_find_project.sh
Executable file
15
.mutt/bin/patch_find_project.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#!/bin/sh
|
||||||
|
if test "$PATCH_PROJECT" != ""; then
|
||||||
|
project="$PATCH_PROJECT"
|
||||||
|
elif grep -q -e "devel@edk2.groups.io" "$file"; then
|
||||||
|
project="edk2"
|
||||||
|
elif grep -q -e "qemu-devel@nongnu.org" "$file"; then
|
||||||
|
project="qemu"
|
||||||
|
# [ ... more checks snipped ... ]
|
||||||
|
fi
|
||||||
|
if test "$project" = ""; then
|
||||||
|
echo "Can't figure project automatically."
|
||||||
|
echo "Use env var PATCH_PROJECT to specify path."
|
||||||
|
fi
|
75
.mutt/bin/patch_lore.sh
Executable file
75
.mutt/bin/patch_lore.sh
Executable file
@ -0,0 +1,75 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# store patch
|
||||||
|
file="$(mktemp ${TMPDIR-/tmp}/mutt-patch-queue-XXXXXXXX)"
|
||||||
|
trap "rm -f $file" EXIT
|
||||||
|
cat > "$file"
|
||||||
|
|
||||||
|
# find project
|
||||||
|
source ~/.mutt/bin/patch-find-project.sh
|
||||||
|
if test "$project" = ""; then
|
||||||
|
echo "ERROR: can't figure project"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# find msgid
|
||||||
|
msgid=$(grep -i -e "^message-id:" "$file" | head -n 1 \
|
||||||
|
| sed -e 's/.*<//' -e 's/>.*//')
|
||||||
|
|
||||||
|
# go!
|
||||||
|
clear
|
||||||
|
cd $HOME/projects/$project
|
||||||
|
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo "#"
|
||||||
|
echo "# try queuing patch (series) for $project, branch $branch"
|
||||||
|
echo "#"
|
||||||
|
echo "# msgid: $msgid"
|
||||||
|
echo "#"
|
||||||
|
|
||||||
|
# create work dir
|
||||||
|
WORK="${TMPDIR-/tmp}/${0##*/}-$$"
|
||||||
|
mkdir "$WORK" || exit 1
|
||||||
|
trap 'rm -rf $file "$WORK"' EXIT
|
||||||
|
|
||||||
|
echo "# fetching from lore ..."
|
||||||
|
echo "#"
|
||||||
|
b4 am --outdir "$WORK" \
|
||||||
|
--apply-cover-trailers \
|
||||||
|
--sloppy-trailers \
|
||||||
|
$msgid || exit 1
|
||||||
|
|
||||||
|
count=$(ls $WORK/*.mbx 2>/dev/null | wc -l)
|
||||||
|
if test "$count" = "0"; then
|
||||||
|
echo "#"
|
||||||
|
echo "# got nothing, trying notmuch instead ..."
|
||||||
|
echo "#"
|
||||||
|
echo "# update db ..."
|
||||||
|
notmuch new
|
||||||
|
echo "# find thread ..."
|
||||||
|
notmuch show \
|
||||||
|
--format=mbox \
|
||||||
|
--entire-thread=true \
|
||||||
|
id:$msgid > $WORK/notmuch.thread
|
||||||
|
echo "# process mails ..."
|
||||||
|
b4 am --outdir "$WORK" \
|
||||||
|
--apply-cover-trailers \
|
||||||
|
--sloppy-trailers \
|
||||||
|
--use-local-mbox $WORK/notmuch.thread \
|
||||||
|
$msgid || exit 1
|
||||||
|
count=$(ls $WORK/*.mbx 2>/dev/null | wc -l)
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "#"
|
||||||
|
echo "# got $count patches, trying to apply ..."
|
||||||
|
echo "#"
|
||||||
|
if git am -m -3 $WORK/*.mbx; then
|
||||||
|
echo "#"
|
||||||
|
echo "# OK"
|
||||||
|
echo "#"
|
||||||
|
else
|
||||||
|
echo "# FAILED, cleaning up"
|
||||||
|
git am --abort
|
||||||
|
git reset --hard
|
||||||
|
fi
|
27
.muttrc
27
.muttrc
@ -30,12 +30,18 @@ unset metoo
|
|||||||
|
|
||||||
## ACCOUNT
|
## ACCOUNT
|
||||||
# GMAIL
|
# GMAIL
|
||||||
set folder= imaps://imap.gmail.com:993
|
#set folder= imaps://imap.gmail.com:99
|
||||||
set spoolfile= +INBOX #or +[Gmail]/Important
|
#set postponed= +[Gmail]/Drafts
|
||||||
set postponed= +[Gmail]/Drafts
|
#set imap_user = 'mathieu.maret@gmail.com'
|
||||||
set imap_user = 'mathieu.maret@gmail.com'
|
# Mathux
|
||||||
#set imap_pass = 'yourpass'
|
set folder= imap://mathux.org:143
|
||||||
|
set postponed= +Drafts #[Gmail]/Drafts
|
||||||
|
set imap_user = 'mathieu'
|
||||||
|
set ssl_starttls=yes
|
||||||
|
|
||||||
|
|
||||||
|
set spoolfile= +INBOX #or +[Gmail]/Important
|
||||||
|
#set imap_pass = 'yourpass'
|
||||||
#set record="imaps://imap.gmail.com/[Gmail]/Sent Mail"
|
#set record="imaps://imap.gmail.com/[Gmail]/Sent Mail"
|
||||||
unset record
|
unset record
|
||||||
set maildir_trash = yes
|
set maildir_trash = yes
|
||||||
@ -47,7 +53,8 @@ set certificate_file=~/.mutt/certificates
|
|||||||
set imap_check_subscribed="yes"
|
set imap_check_subscribed="yes"
|
||||||
set imap_list_subscribed="yes"
|
set imap_list_subscribed="yes"
|
||||||
mailboxes !
|
mailboxes !
|
||||||
set smtp_url = smtp://mathieu.maret@smtp.gmail.com:587/
|
#set smtp_url = smtp://mathieu.maret@smtp.gmail.com:587/
|
||||||
|
set smtp_url = smtp://mathieu@mathux.org:587/
|
||||||
|
|
||||||
## VIEW MAIL
|
## VIEW MAIL
|
||||||
set smileys="(>From)|(:[-^]?[][)(><}{|/DP])"
|
set smileys="(>From)|(:[-^]?[][)(><}{|/DP])"
|
||||||
@ -59,7 +66,8 @@ set pager_stop # "next_page" won't jump to next message at end of messages
|
|||||||
set edit_headers
|
set edit_headers
|
||||||
set attribution="%n wrote:" # attribution format : on day, name wrote (alias=%a if you want to add that)
|
set attribution="%n wrote:" # attribution format : on day, name wrote (alias=%a if you want to add that)
|
||||||
set indent_string="> "
|
set indent_string="> "
|
||||||
set from="Mathieu Maret <mathieu.maret@gmail.com>"
|
#set from="Mathieu Maret <mathieu.maret@gmail.com>"
|
||||||
|
set from="Mathieu Maret <mathieu@mathux.org>"
|
||||||
|
|
||||||
## INDEX
|
## INDEX
|
||||||
set index_format="%4C %Z [%D] %-15.15n %s"
|
set index_format="%4C %Z [%D] %-15.15n %s"
|
||||||
@ -120,4 +128,7 @@ source $alias_file
|
|||||||
#macro index,pager a "<pipe-message>abook --add-email-quiet<return>" "Add this sender to Abook"
|
#macro index,pager a "<pipe-message>abook --add-email-quiet<return>" "Add this sender to Abook"
|
||||||
#bind editor <Tab> complete-query
|
#bind editor <Tab> complete-query
|
||||||
#
|
#
|
||||||
#
|
bind index,pager p noop # default: print
|
||||||
|
macro index,pager pp print
|
||||||
|
macro index,pager pa "<pipe-entry>~/.mutt/bin/patch_apply.sh<enter>"
|
||||||
|
macro index,pager pl "<pipe-entry>~/.mutt/bin/patch_lore.sh<enter>"
|
||||||
|
Loading…
Reference in New Issue
Block a user