mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 09:14:39 +03:00
fix message size in a message in gentestdata
and work around the message in test-upgrade.sh. and add subcommand to open an account, triggering data upgrades.
This commit is contained in:
25
main.go
25
main.go
@ -158,6 +158,7 @@ var commands = []struct {
|
||||
{"gentestdata", cmdGentestdata},
|
||||
{"ximport maildir", cmdXImportMaildir},
|
||||
{"ximport mbox", cmdXImportMbox},
|
||||
{"openaccounts", cmdOpenaccounts},
|
||||
}
|
||||
|
||||
var cmds []cmd
|
||||
@ -2378,3 +2379,27 @@ func cmdMessageParse(c *cmd) {
|
||||
err = enc.Encode(part)
|
||||
xcheckf(err, "write")
|
||||
}
|
||||
|
||||
func cmdOpenaccounts(c *cmd) {
|
||||
c.unlisted = true
|
||||
c.params = "datadir account ..."
|
||||
c.help = `Open and close accounts, for triggering data upgrades, for tests.
|
||||
|
||||
Opens database files directly, not going through a running mox instance.
|
||||
`
|
||||
|
||||
args := c.Parse()
|
||||
if len(args) <= 1 {
|
||||
c.Usage()
|
||||
}
|
||||
|
||||
dataDir := filepath.Clean(args[0])
|
||||
for _, accName := range args[1:] {
|
||||
accDir := filepath.Join(dataDir, "accounts", accName)
|
||||
log.Printf("opening account %s...", filepath.Join(accDir, accName))
|
||||
a, err := store.OpenAccountDB(accDir, accName)
|
||||
xcheckf(err, "open account %s", accName)
|
||||
err = a.Close()
|
||||
xcheckf(err, "close account %s", accName)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user