From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH] convert: preserve indexlevel on conversions
Date: Sat, 8 Feb 2020 18:08:49 +0000 [thread overview]
Message-ID: <20200208180849.26391-1-e@yhbt.net> (raw)
We don't want to blow up users storage too badly when converting
v1 to v2 or break because they don't have Xapian bindings installed.
---
script/public-inbox-convert | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/script/public-inbox-convert b/script/public-inbox-convert
index 906001cb..e13c13f4 100755
--- a/script/public-inbox-convert
+++ b/script/public-inbox-convert
@@ -6,6 +6,7 @@ use warnings;
use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
use PublicInbox::InboxWritable;
use PublicInbox::Config;
+use PublicInbox::Admin;
use PublicInbox::V2Writable;
use PublicInbox::Git;
use PublicInbox::Spawn qw(spawn);
@@ -45,6 +46,14 @@ $old = PublicInbox::InboxWritable->new($old);
if ($old->version >= 2) {
die "Only conversion from v1 inboxes is supported\n";
}
+
+$old->{indexlevel} //= PublicInbox::Admin::detect_indexlevel($old);
+if ($index) {
+ my $mods = {};
+ PublicInbox::Admin::scan_ibx_modules($mods, $old);
+ PublicInbox::Admin::require_or_die(keys %$mods);
+}
+
my $new = { %$old };
$new->{inboxdir} = abs_path($new_dir);
$new->{version} = 2;
next reply other threads:[~2020-02-08 18:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-08 18:08 Eric Wong [this message]
2020-02-08 18:30 ` [PATCH 2/1] t/multi-mid: skip properly w/o DBD::SQLite Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200208180849.26391-1-e@yhbt.net \
--to=e@yhbt.net \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.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).