export: bring matched items up to date on every run
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 2m32s
ci / announce (pull_request) Skipped

Export matched each item against the target and then skipped it, so a second
run -- the usual final pass of a cutover -- never carried anything that had
changed at the source since the first: read and flagged state, moves between
folders, edited contacts, events and Sieve scripts. It reported them as
skipped and exited 0, while the usage guide said matched items were updated.

Matched items are now updated, with one batched /set per type:

- Email: keywords are set to the archive's, added and removed, compared
  case-insensitively. Memberships of folders this run migrated are added and
  removed to match; folders that exist only on the target are left alone,
  and a message is never left in no folder. Properties the server did not
  report are not touched.
- Contacts and events: when both copies carry `updated`, the archive's is
  written only if it is newer; otherwise each property the archive writes is
  compared, and those that differ are sent whole.
- Sieve scripts: the target's copy is downloaded and compared byte for byte,
  and replaced with the archive's when it differs.

Updated items are counted as `updated`; unchanged ones stay `skipped`. The
usage guide now describes this.
This commit is contained in:
2026-09-30 11:32:04 -07:00
parent 5ae0625ee1
commit db76a1044f
6 changed files with 645 additions and 90 deletions
+16 -8
View File
@@ -192,15 +192,23 @@ inbuxa-migrate export \
Writes `ARCHIVE` into an account on a JMAP server, usually inbuxa. It keeps no
state of its own: every run matches the archive against the target afresh.
By default it only adds and updates -- items that match are updated, the
rest are created, and anything already on the target that the archive does
not cover is left alone.
By default it only adds and updates: what the target lacks is created, what
it has is brought up to date, and anything on the target that the archive
does not cover is left alone. So a second run after a later import carries
what changed at the source in between.
Email is matched by Message-ID, or without one by sender, subject, date and
recipients; where several messages share one, size decides. A message the
source kept in several folders -- IMAP and Maildir copies, Gmail labels -- is
written once, in all of them, and a later run adds any folder it is still
missing on the target.
- **Email** is matched by Message-ID, or without one by sender, subject, date
and recipients; where several messages share one, size decides. A message
the source kept in several folders -- IMAP and Maildir copies, Gmail labels
-- is written once, in all of them. On a match, its keywords (read,
flagged and the rest) are set to the archive's, and so are its memberships
of folders this run migrated. Folders that exist only on the target are
left alone, and a message is never left in no folder.
- **Contacts and events** are matched by UID. When both copies carry an
`updated` time, the archive's is written only if it is newer; otherwise
the properties that differ are written.
- **Sieve scripts** are matched by name, and the target's is replaced when
its content differs from the archive's.
`--prune` also deletes what is on the target and not in the archive. It asks
first; `--yes` answers for it, for scripts. Export speaks JMAP only.