From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id AC3121F5A2 for ; Sat, 8 Feb 2020 18:08:49 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] convert: preserve indexlevel on conversions Date: Sat, 8 Feb 2020 18:08:49 +0000 Message-Id: <20200208180849.26391-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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;