]> git.notmuchmail.org Git - notmuch/blob - doc/man1/notmuch-dump.rst
doc: document notmuch-dump header line
[notmuch] / doc / man1 / notmuch-dump.rst
1 ============
2 notmuch-dump
3 ============
4
5 SYNOPSIS
6 ========
7
8 **notmuch** **dump** [--gzip] [--format=(batch-tag|sup)] [--output=<*file*>] [--] [<*search-term*> ...]
9
10 DESCRIPTION
11 ===========
12
13 Dump tags for messages matching the given search terms.
14
15 Output is to the given filename, if any, or to stdout.
16
17 These tags are the only data in the notmuch database that can't be
18 recreated from the messages themselves. The output of notmuch dump is
19 therefore the only critical thing to backup (and much more friendly to
20 incremental backup than the native database files.)
21
22 See **notmuch-search-terms(7)** for details of the supported syntax
23 for <search-terms>. With no search terms, a dump of all messages in
24 the database will be generated. A "--" argument instructs notmuch that
25 the remaining arguments are search terms.
26
27 Supported options for **dump** include
28
29     ``--gzip``
30         Compress the output in a format compatible with **gzip(1)**.
31
32     ``--format=(sup|batch-tag)``
33         Notmuch restore supports two plain text dump formats, both with one
34         message-id per line, followed by a list of tags.
35
36         **batch-tag**
37
38             The default **batch-tag** dump format is intended to more
39             robust against malformed message-ids and tags containing
40             whitespace or non-\ **ascii(7)** characters. Each line has
41             the form
42
43                 +<*encoded-tag*\ > +<*encoded-tag*\ > ... --
44                 id:<*quoted-message-id*\ >
45
46             Tags are hex-encoded by replacing every byte not matching
47             the regex **[A-Za-z0-9@=.,\_+-]** with **%nn** where nn is
48             the two digit hex encoding. The message ID is a valid
49             Xapian query, quoted using Xapian boolean term quoting
50             rules: if the ID contains whitespace or a close paren or
51             starts with a double quote, it must be enclosed in double
52             quotes and double quotes inside the ID must be
53             doubled. The astute reader will notice this is a special
54             case of the batch input format for **notmuch-tag(1)**;
55             note that the single message-id query is mandatory for
56             **notmuch-restore(1)**.
57
58         **sup**
59
60             The **sup** dump file format is specifically chosen to be
61             compatible with the format of files produced by
62             sup-dump. So if you've previously been using sup for mail,
63             then the **notmuch restore** command provides you a way to
64             import all of your tags (or labels as sup calls
65             them). Each line has the following form
66
67                 <*message-id*\ > **(** <*tag*\ > ... **)**
68
69             with zero or more tags are separated by spaces. Note that
70             (malformed) message-ids may contain arbitrary non-null
71             characters. Note also that tags with spaces will not be
72             correctly restored with this format.
73
74     ``--include=(config|tags)``
75
76     Control what kind of metadata is included in the output.
77
78       **config**
79
80         Output configuration data stored in the database. Each line
81         starts with "#@ ", followed by a space seperated key-value
82         pair.  Both key and value are hex encoded if needed.
83
84       **tags**
85
86         Output per-message metadata, namely tags. See *format* above
87         for description of the output.
88
89       The default is to include both tags and configuration
90       information. As of version 2 of the dump format, there is a
91       header line of the following form
92
93       |
94       |  #notmuch-dump <*format*>:<*version*> <*included*>
95
96       where <*included*> is a comma separated list of the above
97       options.
98
99     ``--output=``\ <filename>
100         Write output to given file instead of stdout.
101
102 SEE ALSO
103 ========
104
105 **notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,
106 **notmuch-hooks(5)**, **notmuch-insert(1)**, **notmuch-new(1)**,
107 **notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**,
108 **notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**