unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 628dcff40292a08781bd2d135dfbddc3ad3aa015 912 bytes (raw)
name: devel/draw-thread 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
#!/bin/bash

# This script can be used like
# NOTMUCH_CONFIG=test/tmp.T580-thread-search/notmuch-config \
#    devel/draw-thread thread:0000000000000002 | dot -Tpdf > thread2.pdf

# In addition to notmuch, you will need the following tools installed
# - graphviz
# - formail (part of procmail)

threadid=$1

declare -a edges

declare -a dest
echo "digraph \"$threadid\" {"
for messageid in $(notmuch search --output=messages $threadid); do
    echo "subgraph \"cluster_$messageid\" {"
    printf "\"%s\" [shape=folder];\n" ${messageid#id:}
    for file in $(notmuch search --output=files $messageid); do
        node=$(basename $file)
        printf "\"%s\" [shape=note];\n" $node

        mapfile -t dest < <(formail -x references < $file | tr '<>,' '"" ')
        edge="\"$node\" -> { ${dest[*]} }"
        edges+=($edge)
    done
    echo "}"
done

for edge in "${edges[*]}"; do
    echo $edge
done

echo "}"

debug log:

solving 628dcff4 ...
found 628dcff4 in https://yhetil.org/notmuch/20180410014539.24717-1-david@tethera.net/

applying [1/1] https://yhetil.org/notmuch/20180410014539.24717-1-david@tethera.net/
diff --git a/devel/draw-thread b/devel/draw-thread
new file mode 100755
index 00000000..628dcff4

Checking patch devel/draw-thread...
Applied patch devel/draw-thread cleanly.

index at:
100755 628dcff40292a08781bd2d135dfbddc3ad3aa015	devel/draw-thread

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).