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